Skip to content

Commit

Permalink
Fix possible nullptr deref
Browse files Browse the repository at this point in the history
  • Loading branch information
appgurueu authored Nov 12, 2023
1 parent e3cdd7d commit 9fc8c9c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/script/lua_api/l_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ int ObjectRef::l_set_observers(lua_State *L)
// Reset object to "unmanaged" (sent to everyone)?
if (lua_isnoneornil(L, 2)) {
ServerActiveObject *parent = sao->getParent();
if (!parent->m_observer_names.has_value())
if (parent != nullptr && !parent->m_observer_names.has_value())
throw LuaError("Child observers need to be managed if parent observers are managed");
sao->m_observer_names.reset();
return 0;
Expand Down

0 comments on commit 9fc8c9c

Please sign in to comment.