From c277e8bf3fe730e4546cfdd85155a9cfe6755c82 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Mon, 15 Nov 2021 16:31:38 +0100 Subject: [PATCH] Unset store listeners for creatures --- apps/openmw/mwrender/objects.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/objects.cpp b/apps/openmw/mwrender/objects.cpp index f51008fffa..e208d7191e 100644 --- a/apps/openmw/mwrender/objects.cpp +++ b/apps/openmw/mwrender/objects.cpp @@ -141,11 +141,11 @@ void Objects::removeCell(const MWWorld::CellStore* store) MWWorld::Ptr ptr = iter->second->getPtr(); if(ptr.getCell() == store) { - if (ptr.getClass().isNpc() && ptr.getRefData().getCustomData()) + if (ptr.getClass().isActor() && ptr.getRefData().getCustomData()) { - MWWorld::InventoryStore& invStore = ptr.getClass().getInventoryStore(ptr); - invStore.setInvListener(nullptr, ptr); - invStore.setContListener(nullptr); + if (ptr.getClass().hasInventoryStore(ptr)) + ptr.getClass().getInventoryStore(ptr).setInvListener(nullptr, ptr); + ptr.getClass().getContainerStore(ptr).setContListener(nullptr); } mObjects.erase(iter++);