From e6e3e686c613d2072a9312905914633760634d7c Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Sun, 2 Dec 2012 23:55:17 +0100 Subject: [PATCH] canvas::Element: print warning instead of crash on removing unknown transform --- simgear/canvas/elements/CanvasElement.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 ) -- 2.39.5