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
This commit is contained in:
parent
d7155bde38
commit
a092902483
1 changed files with 9 additions and 1 deletions
|
@ -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, "<?xml")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SGGeod vicinity;
|
||||
if (!_legs.empty()) {
|
||||
vicinity = _legs.back()->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)});
|
||||
|
|
Loading…
Reference in a new issue