Skip to content

Commit

Permalink
Fixed crash when decoding procedures. Example: Sumburgh (EGPB), appro…
Browse files Browse the repository at this point in the history
…ach ILS 27, transition D064L for P3D scenery.
  • Loading branch information
albar965 committed Jul 25, 2021
1 parent 88d5795 commit 2801f24
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ library changes and a new airport ident search for X-Plane.
mess up the window layout. You can still resize the dock windows at the border.
* Fixed issue where flight plan calculation window header text was not updated on flight plan
changes.
* Fixed crash when decoding procedures. Example: Sumburgh (EGPB), approach ILS 27, transition D064L
for P3D scenery.
* Showing status bar again which might be hidden after recent updates.

### MSFS
Expand Down
4 changes: 2 additions & 2 deletions src/query/procedurequery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ void ProcedureQuery::processArtificialLegs(const map::MapAirport& airport, proc:
rwleg.altRestriction.alt1 = std::min(rwleg.altRestriction.alt1, lastAltRestr.alt1);
}

legs.approachLegs.insert(insertPosition, rwleg);
atools::insertInto(legs.approachLegs, insertPosition, rwleg);

// Coordinates for missed after CTL legs are already correct since this new leg is missing when the
// coordinates are calculated
Expand Down Expand Up @@ -1106,7 +1106,7 @@ void ProcedureQuery::processArtificialLegs(const map::MapAirport& airport, proc:
vectorLeg.trueCourse = vectorLeg.intercept =
vectorLeg.disabled = vectorLeg.malteseCross = false;

legs.approachLegs.insert(i + 1, vectorLeg);
atools::insertInto(legs.approachLegs, i + 1, vectorLeg);
} // if(nextLeg.type == proc::INITIAL_FIX && ...
} // for(int i = legs.size() - 2; i >= 0; i--)
} // if(!legs.isEmpty() && addArtificialLegs)
Expand Down
14 changes: 7 additions & 7 deletions src/routestring/routestringreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,13 @@ bool RouteStringReader::createRouteFromString(const QString& routeString, rs::Ro
QList<map::MapAirway> airways;
airwayQuery->getAirwaysForWaypoints(airways, lastRef.id, wp.id, item);
if(!airways.isEmpty())
mapObjectRefs->insert(insertPos,
map::MapObjectRefExt(airways.first().id, map::AIRWAY, airways.first().name));
atools::insertInto(*mapObjectRefs, insertPos,
map::MapObjectRefExt(airways.first().id, map::AIRWAY, airways.first().name));

insertPos = mapObjectRefs->size() - insertOffset;
// Waypoint
curRef = map::MapObjectRefExt(wp.id, wp.position, map::WAYPOINT, wp.ident);
mapObjectRefs->insert(insertPos, curRef);
atools::insertInto(*mapObjectRefs, insertPos, curRef);
}
}
else
Expand All @@ -327,7 +327,7 @@ bool RouteStringReader::createRouteFromString(const QString& routeString, rs::Ro
{
// Add user defined waypoint with original coordinate string
curRef = map::MapObjectRefExt(-1, entry.getPosition(), map::USERPOINTROUTE, item);
mapObjectRefs->insert(mapObjectRefs->size() - insertOffset, curRef);
atools::insertInto(*mapObjectRefs, mapObjectRefs->size() - insertOffset, curRef);
}

// Use the original string as name but limit it for fs
Expand All @@ -353,12 +353,12 @@ bool RouteStringReader::createRouteFromString(const QString& routeString, rs::Ro
QList<map::MapAirway> airways;
airwayQuery->getAirwaysForWaypoints(airways, lastRef.id, curRef.id, lastParseEntry->airway);
if(!airways.isEmpty())
mapObjectRefs->insert(mapObjectRefs->size() - insertOffset,
map::MapObjectRefExt(airways.first().id, map::AIRWAY, airways.first().name));
atools::insertInto(*mapObjectRefs, mapObjectRefs->size() - insertOffset,
map::MapObjectRefExt(airways.first().id, map::AIRWAY, airways.first().name));
}

// Add navaid or airport including original name
mapObjectRefs->insert(mapObjectRefs->size() - insertOffset, curRef);
atools::insertInto(*mapObjectRefs, mapObjectRefs->size() - insertOffset, curRef);
}
}

Expand Down

0 comments on commit 2801f24

Please sign in to comment.