From cc0c6ddaa6aed5c93f83597a58d12fbacba34d46 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Wed, 28 Feb 2018 14:04:56 +0300 Subject: [PATCH] Account for empty victimRef (Bug #4328) --- apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index cd3cd1f80d..be5125a2bf 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -1120,7 +1120,7 @@ namespace MWMechanics if (!Misc::StringUtils::ciEqual(item.getCellRef().getRefId(), MWWorld::ContainerStore::sGoldId)) { const MWWorld::Ptr victimRef = MWBase::Environment::get().getWorld()->searchPtr(item.getCellRef().getOwner(), true); - if (!victimRef.getClass().getCreatureStats(victimRef).isDead()) + if (victimRef.isEmpty() || !victimRef.getClass().getCreatureStats(victimRef).isDead()) mStolenItems[Misc::StringUtils::lowerCase(item.getCellRef().getRefId())][owner] += count; } if (alarm)