canvas::Element: print warning instead of crash on removing unknown transform

This commit is contained in:
Thomas Geymayer 2012-12-02 23:55:17 +01:00
parent 1e6ba0cdc4
commit e6e3e686c6

View File

@ -250,7 +250,17 @@ namespace canvas
{ {
if( parent == _node && child->getNameString() == NAME_TRANSFORM ) 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; _transform_types[ child->getIndex() ] = TT_NONE;
while( !_transform_types.empty() && _transform_types.back() == TT_NONE ) while( !_transform_types.empty() && _transform_types.back() == TT_NONE )