From fd4c7c09f6bab12f1be31ce7dd5f1bd3f0f44dc4 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Mon, 18 Dec 2017 20:56:58 +0100 Subject: [PATCH] Crashreport: https://swift-project.slack.com/archives/G7GD2UP9C/p1513012215000494 Fixed by ignoring all other property indexes --- src/blackgui/components/mappingcomponent.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/blackgui/components/mappingcomponent.cpp b/src/blackgui/components/mappingcomponent.cpp index 969391ae0..258aed316 100644 --- a/src/blackgui/components/mappingcomponent.cpp +++ b/src/blackgui/components/mappingcomponent.cpp @@ -172,20 +172,14 @@ namespace BlackGui void CMappingComponent::ps_onChangedSimulatedAircraftInView(const CVariant &object, const CPropertyIndex &index) { + if (!sGui || !index.contains(CSimulatedAircraft::IndexEnabled)) { return; } // we only deal with enabled/disabled here const CSimulatedAircraft sa = object.to(); // changed in GUI const CSimulatedAircraft saFromBackend = sGui->getIContextNetwork()->getAircraftInRangeForCallsign(sa.getCallsign()); if (!saFromBackend.hasValidCallsign()) { return; } // obviously deleted - if (index.contains(CSimulatedAircraft::IndexEnabled)) - { - const bool enabled = sa.propertyByIndex(index).toBool(); - if (saFromBackend.isEnabled() == enabled) { return; } - CLogMessage(this).info("Request to %1 aircraft %2") << (enabled ? "enable" : "disable") << saFromBackend.getCallsign().toQString(); - sGui->getIContextNetwork()->updateAircraftEnabled(saFromBackend.getCallsign(), enabled); - } - else - { - Q_ASSERT_X(false, "ps_onChangedSimulatedAircraftInView", "Index not supported"); - } + const bool nowEnabled = sa.isEnabled(); + if (saFromBackend.isEnabled() == nowEnabled) { return; } // already same value + CLogMessage(this).info("Request to %1 aircraft %2") << (nowEnabled ? "enable" : "disable") << saFromBackend.getCallsign().toQString(); + sGui->getIContextNetwork()->updateAircraftEnabled(saFromBackend.getCallsign(), nowEnabled); } void CMappingComponent::ps_onAircraftSelectedInView(const QModelIndex &index)