Fix possible 0 pointer access

This commit is contained in:
sapier 2013-06-23 16:09:02 +02:00 committed by kwolekr
parent 967121a34b
commit b1ef850877
1 changed files with 4 additions and 2 deletions

View File

@ -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;