1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

OP-144 Ground/UAVObjects: Add assert(0) when returning null in getField/getObject as there is no reason to try and get a non-existing field. Hopefully this will help us more explictly catch any bugs from this. No objects in IRC or http://forums.openpilot.org/topic/1648-uavobjectgetfield-setvalue-behaviors-etc/ but feel free to revert if I'm missing something.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1656 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-09-16 05:43:48 +00:00 committed by peabody124
parent 832b61ab86
commit 89ba1b59fa
2 changed files with 2 additions and 0 deletions

View File

@ -206,6 +206,7 @@ UAVObjectField* UAVObject::getField(const QString& name)
}
}
// If this point is reached then the field was not found
Q_ASSERT_X(0,"UAVObject::getField",QString("Non existant field " + name + "requested. This indicates a bug. Make sure you also have null checking for non-debug code.").toAscii());
return NULL;
}

View File

@ -259,6 +259,7 @@ UAVObject* UAVObjectManager::getObject(const QString* name, quint32 objId, quint
}
}
}
Q_ASSERT_X(0,"UAVObjectManager::getObject",(QString("Non existant object ") + *name + QString("requested. This indicates a bug. Make sure you also have null checking for non-debug code.")).toAscii());
// If this point is reached then the requested object could not be found
return NULL;
}