1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Ground/UAVObjectBrowser: Don't crash for undefined enum values, just say

invalid

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2244 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-12-18 07:09:32 +00:00 committed by peabody124
parent af99c31a61
commit 50b5d0d289

View File

@ -81,7 +81,12 @@ public:
setChanged(tmpValIndex != value);
TreeItem::setData(value, column);
}
QString enumOptions(int index) { return m_enumOptions.at(index); }
QString enumOptions(int index) {
if((index < 0) || (index >= m_enumOptions.length())) {
return QString("Invalid Value (") + QString().setNum(index) + QString(")");
}
return m_enumOptions.at(index);
}
void apply() {
int value = data(dataColumn).toInt();
QStringList options = m_field->getOptions();