From 80d4589743a16e15cae89824979668a94a847e1c Mon Sep 17 00:00:00 2001 From: James Cotton Date: Thu, 5 May 2011 01:23:43 -0500 Subject: [PATCH] Add assert when enum set to invalid value --- ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp index 9d3a16451..8841429fa 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp @@ -552,6 +552,7 @@ void UAVObjectField::setValue(const QVariant& value, quint32 index) case ENUM: { qint8 tmpenum = options.indexOf( value.toString() ); + Q_ASSERT(tmpenum >= 0); // To catch any programming errors where we set invalid values memcpy(&data[offset + numBytesPerElement*index], &tmpenum, numBytesPerElement); break; }