Skip to content

Commit

Permalink
Fix crash when trying to attach a non existing attachedEffect
Browse files Browse the repository at this point in the history
Reproduction:

g_game.getLocalPlayer():attachEffect(g_attachedEffects.getById(9999))
  • Loading branch information
conde2 committed Nov 13, 2023
1 parent 7da55d9 commit 4a9760f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/client/thing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ void Thing::setShader(const std::string_view name) {
}

void Thing::attachEffect(const AttachedEffectPtr& obj) {
if (!obj)
return;

if (isCreature()) {
if (obj->m_thingType && (obj->m_thingType->isCreature() || obj->m_thingType->isMissile()))
obj->m_direction = static_self_cast<Creature>()->getDirection();
Expand Down

0 comments on commit 4a9760f

Please sign in to comment.