1
0
Fork 0

Fix crash when no waypt controller is created

When we don't build any wapy controller, also bail out, rather than
crashing. Jonathan could trigger this with an empty route on the A320,
although no stand-alone test-case so far.

SF-ID: https://sourceforge.net/p/flightgear/codetickets/2695/
This commit is contained in:
James Turner 2022-01-18 12:17:13 +00:00
parent f198ac8d8d
commit 29ef5210a7

View file

@ -784,7 +784,7 @@ void GPS::wp1Changed()
_wayptController.reset(new DirectToController(this, _currentWaypt, _wp0_position));
}
const bool ok = _wayptController->init();
const bool ok = _wayptController && _wayptController->init();
if (!ok) {
SG_LOG(SG_AUTOPILOT, SG_WARN, "GPS failed to init RNAV controller for waypoint " << _currentWaypt->ident());
_wayptController.reset();