Fix crash when adding items to certain disabled creatures (bug #4441)

This commit is contained in:
David Cernat 2018-06-05 18:09:10 +03:00
parent 7605d928db
commit 04a2025340

View file

@ -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());