From 4fa2b76f013745cb3ae176890f55faf67bde375f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 18 Mar 2020 14:29:28 +0200 Subject: [PATCH] Fix error in VDomDocument::elementById. Searching in cache did not check tag if provided. --- src/libs/ifc/xml/vdomdocument.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/libs/ifc/xml/vdomdocument.cpp b/src/libs/ifc/xml/vdomdocument.cpp index df1b0061c..cd0733d4c 100644 --- a/src/libs/ifc/xml/vdomdocument.cpp +++ b/src/libs/ifc/xml/vdomdocument.cpp @@ -273,11 +273,21 @@ QDomElement VDomDocument::elementById(quint32 id, const QString &tagName, bool u if (m_elementIdCache.contains(id)) { - const QDomElement e = m_elementIdCache.value(id); - if (e.parentNode().nodeType() != QDomNode::BaseNode) - { - return e; - } + const QDomElement e = m_elementIdCache.value(id); + if (e.parentNode().nodeType() != QDomNode::BaseNode) + { + if (not tagName.isEmpty()) + { + if (e.tagName() == tagName) + { + return e; + } + } + else + { + return e; + } + } } if (updateCache)