From 3afd1855c66446e77f2d3fd47e44c609593cff84 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Mon, 20 Apr 2015 12:03:00 -0700 Subject: [PATCH] Correctly handle UAS going away --- src/ui/HDDisplay.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ui/HDDisplay.cc b/src/ui/HDDisplay.cc index 6580c651e..6a513b62b 100644 --- a/src/ui/HDDisplay.cc +++ b/src/ui/HDDisplay.cc @@ -473,16 +473,17 @@ void HDDisplay::renderOverlay() */ void HDDisplay::setActiveUAS(UASInterface* uas) { - if (!uas) - return; // Disconnect any previously connected active UAS if (this->uas != NULL) { removeSource(this->uas); + this->uas = NULL; } - // Now connect the new UAS - addSource(uas); - this->uas = uas; + if (uas) { + // Now connect the new UAS + addSource(uas); + this->uas = uas; + } } /** -- 2.22.0