]> git.mxchange.org Git - simgear.git/commitdiff
canvas::Element: print warning instead of crash on removing unknown transform
authorThomas Geymayer <tomgey@gmail.com>
Sun, 2 Dec 2012 22:55:17 +0000 (23:55 +0100)
committerThomas Geymayer <tomgey@gmail.com>
Sun, 2 Dec 2012 22:55:34 +0000 (23:55 +0100)
simgear/canvas/elements/CanvasElement.cxx

index 934767cf491acd8504bd28a21df1eb53e46a47b2..7b8a8c6b74f26b8c3af07d053fc690f66fff6b4e 100644 (file)
@@ -250,7 +250,17 @@ namespace canvas
   {
     if( parent == _node && child->getNameString() == NAME_TRANSFORM )
     {
-      assert(child->getIndex() < static_cast<int>(_transform_types.size()));
+      if( child->getIndex() >= static_cast<int>(_transform_types.size()) )
+      {
+        SG_LOG
+        (
+          SG_GENERAL,
+          SG_WARN,
+          "Element::childRemoved: unknown transform: " << child->getPath()
+        );
+        return;
+      }
+
       _transform_types[ child->getIndex() ] = TT_NONE;
 
       while( !_transform_types.empty() && _transform_types.back() == TT_NONE )