mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
Fix rare crash and swift not being notified about a failed plane adding
This fixes are rare case, that no XPMP plane could be created (no model was found) and this was not signaled to swift.
This commit is contained in:
committed by
Klaus Basan
parent
dc9b2a42f7
commit
ef8c7d7d1c
Submodule src/xswiftbus/libxplanemp updated: 982162942a...860edd58f0
@@ -258,17 +258,20 @@ namespace XSwiftBus
|
||||
id = XPMPCreatePlaneWithModelName(modelName.c_str(), aircraftIcao.c_str(), airlineIcao.c_str(), livery.c_str(), getPlaneData, planeLoaded, static_cast<void *>(this));
|
||||
}
|
||||
|
||||
if (id)
|
||||
if (!id)
|
||||
{
|
||||
Plane *plane = new Plane(id, callsign, aircraftIcao, airlineIcao, livery, modelName);
|
||||
m_planesByCallsign[callsign] = plane;
|
||||
m_planesById[id] = plane;
|
||||
|
||||
// Create view menu item
|
||||
CMenuItem planeViewMenuItem = m_followPlaneViewSubMenu.item(callsign, [this, callsign] { enableFollowPlaneView(callsign); });
|
||||
m_followPlaneViewMenuItems[callsign] = planeViewMenuItem;
|
||||
m_followPlaneViewSequence.push_back(callsign);
|
||||
emitPlaneAddingFailed(callsign);
|
||||
return;
|
||||
}
|
||||
|
||||
Plane *plane = new Plane(id, callsign, aircraftIcao, airlineIcao, livery, modelName);
|
||||
m_planesByCallsign[callsign] = plane;
|
||||
m_planesById[id] = plane;
|
||||
|
||||
// Create view menu item
|
||||
CMenuItem planeViewMenuItem = m_followPlaneViewSubMenu.item(callsign, [this, callsign] { enableFollowPlaneView(callsign); });
|
||||
m_followPlaneViewMenuItems[callsign] = planeViewMenuItem;
|
||||
m_followPlaneViewSequence.push_back(callsign);
|
||||
}
|
||||
|
||||
void CTraffic::removePlane(const std::string &callsign)
|
||||
|
||||
Reference in New Issue
Block a user