From ed92edc42137f7051b8568eb17fbd0c0de241475 Mon Sep 17 00:00:00 2001 From: PT_Dreamer Date: Sat, 2 Jun 2012 01:12:55 +0100 Subject: [PATCH] GCS - Should fix crashes when opening and closing settings page --- .../src/plugins/notify/notifypluginoptionspage.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/notify/notifypluginoptionspage.cpp b/ground/openpilotgcs/src/plugins/notify/notifypluginoptionspage.cpp index fa8ff053f..38df0eb52 100644 --- a/ground/openpilotgcs/src/plugins/notify/notifypluginoptionspage.cpp +++ b/ground/openpilotgcs/src/plugins/notify/notifypluginoptionspage.cpp @@ -256,7 +256,10 @@ void NotifyPluginOptionsPage::addDynamicField(UAVObjectField* objField) _dynamicFieldCondition->removeItem(smaller); _dynamicFieldCondition->removeItem(bigger); } - _dynamicFieldCondition->setCurrentIndex(_dynamicFieldCondition->findText(NotifyPluginOptionsPage::conditionValues.at(_selectedNotification->getCondition()))); + int cond=_selectedNotification->getCondition(); + if(cond<0) + return; + _dynamicFieldCondition->setCurrentIndex(_dynamicFieldCondition->findText(NotifyPluginOptionsPage::conditionValues.at(cond))); connect(_dynamicFieldCondition, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_changedIndex_rangeValue(QString))); @@ -434,8 +437,10 @@ void NotifyPluginOptionsPage::updateConfigView(NotificationItem* notification) _optionsPage->SoundCollectionList->setCurrentIndex(_optionsPage->SoundCollectionList->findText("default")); _optionsPage->Sound3->setCurrentIndex(_optionsPage->Sound3->findText(notification->getSound3())); } - - _dynamicFieldCondition->setCurrentIndex(_dynamicFieldCondition->findText(NotifyPluginOptionsPage::conditionValues.at(notification->getCondition()))); + int cond=notification->getCondition(); + if(cond<0) + return; + _dynamicFieldCondition->setCurrentIndex(_dynamicFieldCondition->findText(NotifyPluginOptionsPage::conditionValues.at(cond))); _sayOrder->setCurrentIndex(notification->getSayOrder());