From 358fb70ee0c1cea367c2c267c56b6532619e6282 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 24 Oct 2020 15:48:57 +0100 Subject: [PATCH] Catch XML errors parsing traffic files Sentry-Id: FLIGHTGEAR-EQ --- src/Traffic/TrafficMgr.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Traffic/TrafficMgr.cxx b/src/Traffic/TrafficMgr.cxx index ab9ad933d..d4ed24a2a 100644 --- a/src/Traffic/TrafficMgr.cxx +++ b/src/Traffic/TrafficMgr.cxx @@ -382,9 +382,13 @@ private: SG_LOG(SG_AI, SG_DEBUG, "parsing traffic in:" << p); simgear::PathList trafficFiles = d2.children(simgear::Dir::TYPE_FILE, ".xml"); for (const auto& xml : trafficFiles) { - readXML(xml, *this); - if (_cancelThread) { - return; + try { + readXML(xml, *this); + if (_cancelThread) { + return; + } + } catch (sg_exception& e) { + SG_LOG(SG_AI, SG_WARN, "XML error parsing traffic file:" << xml << "\n\t" << e.getFormattedMessage()); } } } // of sub-directories iteration