From 306bfcbdf21a0292775b644e57a0c1f8606d7226 Mon Sep 17 00:00:00 2001 From: cc9cii Date: Tue, 8 Dec 2015 00:27:20 +1100 Subject: [PATCH] Fix exception when deleting a record while dialogue subview for that record is open. --- apps/opencs/model/world/idtable.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/opencs/model/world/idtable.cpp b/apps/opencs/model/world/idtable.cpp index ec666b3dfc..ec492a91ff 100644 --- a/apps/opencs/model/world/idtable.cpp +++ b/apps/opencs/model/world/idtable.cpp @@ -163,7 +163,11 @@ void CSMWorld::IdTable::cloneRecord(const std::string& origin, ///This method can return only indexes to the top level table cells QModelIndex CSMWorld::IdTable::getModelIndex (const std::string& id, int column) const { - return index(mIdCollection->getIndex (id), column); + int idx = mIdCollection->searchId (id); + if (idx != -1) + return index(mIdCollection->getIndex (id), column); + else + return QModelIndex(); } void CSMWorld::IdTable::setRecord (const std::string& id,