Skip to content

Commit

Permalink
Fix possible 0 pointer access
Browse files Browse the repository at this point in the history
  • Loading branch information
sapier authored and kwolekr committed Jul 3, 2013
1 parent 967121a commit b1ef850
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/script/common/c_converter.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit b1ef850

Please sign in to comment.