From 596f42e408d3906939707c07f32f42556caaa404 Mon Sep 17 00:00:00 2001 From: Koncord Date: Thu, 29 Jun 2017 14:36:56 +0800 Subject: [PATCH] [Client] Fix "invalid iterator" error --- apps/openmw/mwmp/LocalActor.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmp/LocalActor.cpp b/apps/openmw/mwmp/LocalActor.cpp index 218b8e30c..ffaf8e323 100644 --- a/apps/openmw/mwmp/LocalActor.cpp +++ b/apps/openmw/mwmp/LocalActor.cpp @@ -195,13 +195,12 @@ void LocalActor::updateEquipment(bool forceUpdate) MWWorld::ContainerStoreIterator it = invStore.getSlot(slot); auto &item = equipedItems[slot]; - auto &cellRef = it->getCellRef(); - if (it != invStore.end() && !::Misc::StringUtils::ciEqual(cellRef.getRefId(), item.refId)) + if (it != invStore.end() && !::Misc::StringUtils::ciEqual(it->getCellRef().getRefId(), item.refId)) { equipmentChanged = true; - item.refId = cellRef.getRefId(); - item.charge = cellRef.getCharge(); + item.refId = it->getCellRef().getRefId(); + item.charge = it->getCellRef().getCharge(); if (slot == MWWorld::InventoryStore::Slot_CarriedRight) { MWMechanics::WeaponType weaptype; @@ -211,7 +210,7 @@ void LocalActor::updateEquipment(bool forceUpdate) item.count = 1; } else - item.count = invStore.count(cellRef.getRefId()); + item.count = invStore.count(it->getCellRef().getRefId()); } else if (it == invStore.end() && !item.refId.empty()) {