]> git.mxchange.org Git - flightgear.git/commitdiff
make sure the node for the AI model removal report exists;
authormfranz <mfranz>
Sun, 26 Nov 2006 12:02:06 +0000 (12:02 +0000)
committermfranz <mfranz>
Sun, 26 Nov 2006 12:02:06 +0000 (12:02 +0000)
addressing a node with its path is unsafe at that time

src/AIModel/AIBase.cxx
src/AIModel/AIBase.hxx

index de52894b0e1ab95f52d5f3e37c34f5ababae09f7..da109c1c7ae8fd25753ec87f26f54168ea5c6ca2 100644 (file)
@@ -52,6 +52,7 @@ const double FGAIBase::lbs_to_slugs = 0.031080950172;   //conversion factor
 
 FGAIBase::FGAIBase(object_type ot) :
     props( NULL ),
+    model_removed( fgGetNode("/ai/models/model-removed", true) ),
     manager( NULL ),
     fp( NULL ),
     _refID( _newAIModelID() ),
@@ -77,7 +78,7 @@ FGAIBase::~FGAIBase() {
     if (props) {
         SGPropertyNode* parent = props->getParent();
         if (parent) {
-            fgSetString("/ai/models/model-removed", props->getPath());
+            model_removed->setStringValue(props->getPath());
             parent->removeChild(props->getName(), props->getIndex(), false);
         }
     }
index 8b72958f1553781c762f8a1e6789da4c7fbbadef..2fa960ace3cb4eb6ea9073ddb399d183d4210f4c 100644 (file)
@@ -80,6 +80,7 @@ public:
 protected:
 
     SGPropertyNode_ptr props;
+    SGPropertyNode_ptr model_removed; // where to report model removal
     FGAIManager* manager;
 
     // these describe the model's actual state