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

pull/445/head
David Cernat 7 years ago
parent 7605d928db
commit 04a2025340

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

Loading…
Cancel
Save