From 9aca70dd92adb531393324386b1d88cb7686762b Mon Sep 17 00:00:00 2001 From: Matias Lavik Date: Thu, 21 Mar 2024 15:04:06 +0100 Subject: [PATCH] Don't throw runtime error if endElement is called without a bound element, as this is not necessarily a critical issue. --- sources/src/parser/citygmlelementparser.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sources/src/parser/citygmlelementparser.cpp b/sources/src/parser/citygmlelementparser.cpp index 5a30c868..c9664d38 100644 --- a/sources/src/parser/citygmlelementparser.cpp +++ b/sources/src/parser/citygmlelementparser.cpp @@ -37,8 +37,10 @@ namespace citygml { // This might happen if an container element that usally contains a child element links to an exting object using XLink an thus // uses a combined start/end element: e.g.: // For such elements a child parser must only be created if there is no xlink attribute. - CITYGML_LOG_ERROR(m_logger, "CityGMLElementParser::endElement called on unbound " << elementParserName() << " object for element <" << node << "> at " << getDocumentLocation()); - throw std::runtime_error("CityGMLElementParser::endElement called on unbound CityGMLElementParser object."); + // It can also happen in cases when a only contains ignored elements. + CITYGML_LOG_WARN(m_logger, "CityGMLElementParser::endElement called on unbound " << elementParserName() << " object for element <" << node << "> at " << getDocumentLocation()); + m_documentParser.removeCurrentElementParser(this); + return true; } if (m_boundElement == node) {