mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Fix possible 0 pointer access
This commit is contained in:
parent
967121a34b
commit
b1ef850877
@ -226,9 +226,11 @@ bool getstringfield(lua_State *L, int table,
|
|||||||
if(lua_isstring(L, -1)){
|
if(lua_isstring(L, -1)){
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
const char *ptr = lua_tolstring(L, -1, &len);
|
const char *ptr = lua_tolstring(L, -1, &len);
|
||||||
|
if (ptr) {
|
||||||
result.assign(ptr, len);
|
result.assign(ptr, len);
|
||||||
got = true;
|
got = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
return got;
|
return got;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user