make sure the node for the AI model removal report exists;
addressing a node with its path is unsafe at that time
This commit is contained in:
parent
68db72bf4d
commit
c0e1a380d6
2 changed files with 3 additions and 1 deletions
|
@ -52,6 +52,7 @@ const double FGAIBase::lbs_to_slugs = 0.031080950172; //conversion factor
|
||||||
|
|
||||||
FGAIBase::FGAIBase(object_type ot) :
|
FGAIBase::FGAIBase(object_type ot) :
|
||||||
props( NULL ),
|
props( NULL ),
|
||||||
|
model_removed( fgGetNode("/ai/models/model-removed", true) ),
|
||||||
manager( NULL ),
|
manager( NULL ),
|
||||||
fp( NULL ),
|
fp( NULL ),
|
||||||
_refID( _newAIModelID() ),
|
_refID( _newAIModelID() ),
|
||||||
|
@ -77,7 +78,7 @@ FGAIBase::~FGAIBase() {
|
||||||
if (props) {
|
if (props) {
|
||||||
SGPropertyNode* parent = props->getParent();
|
SGPropertyNode* parent = props->getParent();
|
||||||
if (parent) {
|
if (parent) {
|
||||||
fgSetString("/ai/models/model-removed", props->getPath());
|
model_removed->setStringValue(props->getPath());
|
||||||
parent->removeChild(props->getName(), props->getIndex(), false);
|
parent->removeChild(props->getName(), props->getIndex(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
SGPropertyNode_ptr props;
|
SGPropertyNode_ptr props;
|
||||||
|
SGPropertyNode_ptr model_removed; // where to report model removal
|
||||||
FGAIManager* manager;
|
FGAIManager* manager;
|
||||||
|
|
||||||
// these describe the model's actual state
|
// these describe the model's actual state
|
||||||
|
|
Loading…
Reference in a new issue