From: Thomas Geymayer Date: Sun, 2 Dec 2012 22:55:17 +0000 (+0100) Subject: canvas::Element: print warning instead of crash on removing unknown transform X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e6e3e686c613d2072a9312905914633760634d7c;p=simgear.git canvas::Element: print warning instead of crash on removing unknown transform --- diff --git a/simgear/canvas/elements/CanvasElement.cxx b/simgear/canvas/elements/CanvasElement.cxx index 934767cf..7b8a8c6b 100644 --- a/simgear/canvas/elements/CanvasElement.cxx +++ b/simgear/canvas/elements/CanvasElement.cxx @@ -250,7 +250,17 @@ namespace canvas { if( parent == _node && child->getNameString() == NAME_TRANSFORM ) { - assert(child->getIndex() < static_cast(_transform_types.size())); + if( child->getIndex() >= static_cast(_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 )