Skip to content

Commit

Permalink
Another attempt at fixing objects crash
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed Jan 25, 2024
1 parent 25f8a91 commit a01e7b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Server/Components/Objects/objects_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void ObjectComponent::onTick(Microseconds elapsed, TimePoint now)
for (auto it = processedObjects.begin(); it != processedObjects.end();)
{
Object* obj = *(it++);
if (obj->advance(elapsed, now))
if (obj && obj->advance(elapsed, now))
{
ScopedPoolReleaseLock lock(*this, *obj);
eventDispatcher.dispatch(&ObjectEventHandler::onMoved, *obj);
Expand All @@ -23,7 +23,7 @@ void ObjectComponent::onTick(Microseconds elapsed, TimePoint now)
for (auto it = processedPlayerObjects.begin(); it != processedPlayerObjects.end();)
{
PlayerObject* obj = *(it++);
if (obj->advance(elapsed, now))
if (obj && obj->advance(elapsed, now))
{
ScopedPoolReleaseLock lock(obj->getObjects(), *obj);
eventDispatcher.dispatch(&ObjectEventHandler::onPlayerObjectMoved, obj->getObjects().getPlayer(), *obj);
Expand Down

0 comments on commit a01e7b4

Please sign in to comment.