From 313686bba591f787dd41c1afe358305f7ee57334 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 26 Feb 2019 22:54:45 +0100 Subject: [PATCH] Avoid null pointer dereference. --- src/bindings/lua/lua_host.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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"); -- 2.20.1