aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-06-23 16:09:02 +0200
committerkwolekr <kwolekr@minetest.net>2013-07-02 20:01:48 -0400
commitb1ef850877278d2af0b35f792e34b39258cf875f (patch)
treea85ff3855f0590f5f54bdaec659a1d6a7b9e8054 /src/script
parent967121a34bbc60e6b46c7ec470b151f668ef1fef (diff)
downloadminetest-b1ef850877278d2af0b35f792e34b39258cf875f.tar.gz
minetest-b1ef850877278d2af0b35f792e34b39258cf875f.tar.bz2
minetest-b1ef850877278d2af0b35f792e34b39258cf875f.zip
Fix possible 0 pointer access
Diffstat (limited to 'src/script')
-rw-r--r--src/script/common/c_converter.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/script/common/c_converter.cpp b/src/script/common/c_converter.cpp
index 65c3654ae..df86f2daf 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;