]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBase.cxx
Durk Talsma:
[flightgear.git] / src / AIModel / AIBase.cxx
index 7560ff0493192fd7110e7bfdcf45c25346e017e4..e816b232b70d6c5561c472dd1c688ec34362a66f 100644 (file)
@@ -160,7 +160,6 @@ ssgBranch * FGAIBase::load3DModel(const string& fg_root,
                            prop_root,
                            sim_time_sec);
       manager->setModel(path, model);
-      model->ref();
     }
   //else
   //  {
@@ -169,6 +168,10 @@ ssgBranch * FGAIBase::load3DModel(const string& fg_root,
   //    aip.setVisible(false);
   //    globals->get_scenery()->get_scene_graph()->addKid(aip.getSceneGraph());
   // do some setModel stuff.
+  
+  if (model)
+    model->ref();
+
   return model;
 }