From: sapier Date: Sun, 23 Jun 2013 14:09:02 +0000 (+0200) Subject: Fix possible 0 pointer access X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=b1ef850877278d2af0b35f792e34b39258cf875f;p=zefram%2Fminetest%2Fminetest_engine.git Fix possible 0 pointer access --- diff --git a/src/script/common/c_converter.cpp b/src/script/common/c_converter.cpp index 65c3654a..df86f2da 100644 --- a/src/script/common/c_converter.cpp +++ b/src/script/common/c_converter.cpp @@ -226,8 +226,10 @@ bool getstringfield(lua_State *L, int table, if(lua_isstring(L, -1)){ size_t len = 0; const char *ptr = lua_tolstring(L, -1, &len); - result.assign(ptr, len); - got = true; + if (ptr) { + result.assign(ptr, len); + got = true; + } } lua_pop(L, 1); return got;