]> git.mxchange.org Git - flightgear.git/commitdiff
Avoid a segfault when a named object is not found for an animation.
authordavid <david>
Wed, 19 Jun 2002 02:58:06 +0000 (02:58 +0000)
committerdavid <david>
Wed, 19 Jun 2002 02:58:06 +0000 (02:58 +0000)
Ensure that global animations are applied to the model.

src/Model/model.cxx

index 430c48cc01d41f4ec1f57a14d6ba549811de2b6f..3f1078cff0da8dd72d7bc533582bac359e3bd03c 100644 (file)
@@ -229,6 +229,8 @@ FG3DModel::init (const string &path)
       animation_nodes[i]->getChildren("object-name");
     if (name_nodes.size() < 1) {
       Animation * animation = make_animation(0, animation_nodes[i]);
+      if (animation != 0)
+       _animations.push_back(animation);
     } else {
       for (unsigned int j = 0; j < name_nodes.size(); j++) {
         Animation * animation =
@@ -309,7 +311,8 @@ FG3DModel::make_animation (const char * object_name,
     object = _model;
   }
 
-  animation->init(object, node);
+  if (animation != 0)
+    animation->init(object, node);
   return animation;
 }