From 4c8449c83443eda468e824c0823c27b9ba9d5dcb Mon Sep 17 00:00:00 2001
From: Don Gagne <don@thegagnes.com>
Date: Fri, 21 Feb 2014 20:27:43 -0800
Subject: [PATCH] Fix crash after last UAS is removed

ui->waitingLabel is deleted and set to NULL when mode is PX4. Must
check for NULL before using it.
---
 src/ui/QGCConfigView.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/ui/QGCConfigView.cc b/src/ui/QGCConfigView.cc
index 16147f3e4b..f2167b6302 100644
--- a/src/ui/QGCConfigView.cc
+++ b/src/ui/QGCConfigView.cc
@@ -95,9 +95,11 @@ void QGCConfigView::activeUASChanged(UASInterface* uas)
         }
     }
     else {
-        //restore waiting label if we no longer have a connection
-        ui->gridLayout->addWidget(ui->waitingLabel);
-        ui->waitingLabel->setVisible(true);
+        if (ui->waitingLabel) {
+            //restore waiting label if we no longer have a connection
+            ui->gridLayout->addWidget(ui->waitingLabel);
+            ui->waitingLabel->setVisible(true);
+        }
     }
 
 }
-- 
GitLab