From a0929024833da09f49343f2cd13c7f5b0c0cccc4 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 17 Dec 2020 10:30:39 +0000 Subject: [PATCH] If loading plain text route, check for an XML header Avoids errors when we try to parse an XML file as plain text. Sentry-Id: FLIGHTGEAR-J6 --- src/Navaids/FlightPlan.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Navaids/FlightPlan.cxx b/src/Navaids/FlightPlan.cxx index 22fb593e6..79ec67bb2 100644 --- a/src/Navaids/FlightPlan.cxx +++ b/src/Navaids/FlightPlan.cxx @@ -1325,13 +1325,21 @@ bool FlightPlan::loadPlainTextFormat(const SGPath& path) continue; // ignore empty/comment lines } + // prevent Sentry error 'FLIGHTGEAR-J6', when we try loading XML + // data here + if (simgear::strutils::starts_with(line, "waypoint()->position(); } WayptRef w = waypointFromString(line, vicinity); if (!w) { - throw sg_io_exception("Failed to create waypoint from line '" + line + "'."); + SG_LOG(SG_NAVAID, SG_ALERT, "Failed to create waypoint from '" << line << "' in " << path); + _legs.clear(); + return false; } _legs.push_back(LegRef{new Leg(this, w)});