Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid null pointer dereference.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 26 Feb 2019 21:54:45 +0000 (22:54 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 27 Feb 2019 14:26:19 +0000 (15:26 +0100)
src/bindings/lua/lua_host.cpp

index 175be6e..7adcf77 100644 (file)
@@ -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");