diff --git a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp index b82602181..5ccd7371f 100644 --- a/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjects/uavobjectfield.cpp @@ -492,7 +492,7 @@ void UAVObjectField::clear() switch (type) { case BITFIELD: - memset(&data[offset], 0, numBytesPerElement*((quint32)(numElements/8))); + memset(&data[offset], 0, numBytesPerElement*((quint32)(1+(numElements-1)/8))); break; default: memset(&data[offset], 0, numBytesPerElement*numElements);