1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

Make scope gadget check if object exists before using it. Avoids segfaults

when scoped objects disappear.
This commit is contained in:
James Cotton 2011-08-29 11:37:22 -05:00
parent ae1dd945b1
commit 1de58ebb87

View File

@ -385,8 +385,15 @@ void ScopeGadgetWidget::addCurvePlot(QString uavObject, QString uavFieldSubField
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject((plotData->uavObject)));
if(!obj) {
qDebug() << "Object " << plotData->uavObject << " is missing";
return;
}
UAVObjectField* field = obj->getField(plotData->uavField);
if(!field) {
qDebug() << "Field " << plotData->uavField << " of object " << plotData->uavObject << " is missing";
return;
}
QString units = field->getUnits();
if(units == 0)