From ede1b97b4658156b8287f150e46f46a38fc44dae Mon Sep 17 00:00:00 2001 From: cc9cii Date: Wed, 19 Nov 2014 18:10:29 +1000 Subject: [PATCH] Check the type of universal id before getting its id. Should resolve bug #2137 --- apps/opencs/view/doc/view.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 8b5efbea7..8dd8494dc 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -474,8 +474,13 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin { foreach(SubView *sb, mSubViews) { - if((isReferenceable && (CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Referenceable, id.getId()) == CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Referenceable, sb->getUniversalId().getId()))) - || (!isReferenceable && (id == sb->getUniversalId()))) + bool isSubViewReferenceable = + sb->getUniversalId().getType() == CSMWorld::UniversalId::Type_Referenceable; + + if((isReferenceable && isSubViewReferenceable && + id.getId() == sb->getUniversalId().getId()) + || + (!isReferenceable && id == sb->getUniversalId())) { sb->setFocus(Qt::OtherFocusReason); // FIXME: focus not quite working return;