From 04a202534085186d93911c7195489e79c384e596 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 5 Jun 2018 18:09:10 +0300 Subject: [PATCH] Fix crash when adding items to certain disabled creatures (bug #4441) --- apps/openmw/mwrender/objects.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index f0a3d2e38..db6772eaa 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -123,11 +123,12 @@ bool Objects::removeObject (const MWWorld::Ptr& ptr) mObjects.erase(iter); - if (ptr.getClass().isNpc()) + if (ptr.getClass().isActor()) { - MWWorld::InventoryStore& store = ptr.getClass().getInventoryStore(ptr); - store.setInvListener(NULL, ptr); - store.setContListener(NULL); + if (ptr.getClass().hasInventoryStore(ptr)) + ptr.getClass().getInventoryStore(ptr).setInvListener(NULL, ptr); + + ptr.getClass().getContainerStore(ptr).setContListener(NULL); } ptr.getRefData().getBaseNode()->getParent(0)->removeChild(ptr.getRefData().getBaseNode());