Skip to content

Commit

Permalink
Do not dereference a nullptr
Browse files Browse the repository at this point in the history
  • Loading branch information
ifakmme committed Apr 21, 2015
1 parent e1f44f7 commit df6720a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sol/stack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ struct getter<T*> {
static T* get(lua_State* L, int index = -1) {
void* udata = lua_touserdata(L, index);
T** obj = static_cast<T**>(udata);

if (obj == nullptr)
return nullptr;

return *obj;
}
};
Expand Down

0 comments on commit df6720a

Please sign in to comment.