diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index 59f3dd4fee..7e8492a366 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -717,7 +717,11 @@ lxcNetworkGetParseDataByIndexLegacy(lxcNetworkParseDataArray *networks, } /* Return last element added like a stack. */ - return networks->parseData[ndata - 1]; + if (ndata > 0) + return networks->parseData[ndata - 1]; + + /* Not able to retrive an element */ + return NULL; }