From: Arnaud Giersch Date: Tue, 26 Feb 2019 21:54:45 +0000 (+0100) Subject: Avoid null pointer dereference. X-Git-Tag: v3_22~222 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/313686bba591f787dd41c1afe358305f7ee57334 Avoid null pointer dereference. --- diff --git a/src/bindings/lua/lua_host.cpp b/src/bindings/lua/lua_host.cpp index 175be6ec03..7adcf7755b 100644 --- a/src/bindings/lua/lua_host.cpp +++ b/src/bindings/lua/lua_host.cpp @@ -30,8 +30,7 @@ sg_host_t sglua_check_host(lua_State * L, int index) lua_getfield(L, index, HOST_FIELDNAME); sg_host_t *pi = (sg_host_t *) luaL_checkudata(L, lua_gettop(L), HOST_MODULE_NAME); lua_pop(L, 1); - if (pi == nullptr) - XBT_ERROR("luaL_checkudata() returned nullptr"); + xbt_assert(pi != nullptr, "luaL_checkudata() returned nullptr"); sg_host_t ht = *pi; if (not ht) luaL_error(L, "null Host");