diff --git a/ground/src/plugins/uavobjects/uavobjectfield.cpp b/ground/src/plugins/uavobjects/uavobjectfield.cpp index 520a17c58..0677ad8e6 100644 --- a/ground/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/src/plugins/uavobjects/uavobjectfield.cpp @@ -27,6 +27,7 @@ */ #include "uavobjectfield.h" #include +#include UAVObjectField::UAVObjectField(const QString& name, const QString& units, FieldType type, quint32 numElements, const QStringList& options) { @@ -444,6 +445,11 @@ QVariant UAVObjectField::getValue(quint32 index) { quint8 tmpenum; memcpy(&tmpenum, &data[offset + numBytesPerElement*index], numBytesPerElement); +// Q_ASSERT((tmpenum < options.length()) && (tmpenum >= 0)); // catch bad enum settings + if(tmpenum >= options.length()) { + qDebug() << "Invalid value for" << name; + return QVariant( QString("Bad Value") ); + } return QVariant( options[tmpenum] ); break; }