diff --git a/simgear/scene/model/ModelRegistry.cxx b/simgear/scene/model/ModelRegistry.cxx index 6355acd9..315f079e 100644 --- a/simgear/scene/model/ModelRegistry.cxx +++ b/simgear/scene/model/ModelRegistry.cxx @@ -494,13 +494,14 @@ struct ACOptimizePolicy : public OptimizeModelPolicy { { ref_ptr optimized = OptimizeModelPolicy::optimize(node, fileName, opt); + Group* group = dynamic_cast(optimized.get()); MatrixTransform* transform = dynamic_cast(optimized.get()); - if (transform && transform->getMatrix().isIdentity() - && transform->getName().empty() - && transform->getNumChildren() == 1) { - optimized = static_cast(transform->getChild(0)); - Group* group = dynamic_cast(optimized.get()); + if (((transform && transform->getMatrix().isIdentity()) || group) + && group->getName().empty() + && group->getNumChildren() == 1) { + optimized = static_cast(group->getChild(0)); + group = dynamic_cast(optimized.get()); if (group && group->getName().empty() && group->getNumChildren() == 1) optimized = static_cast(group->getChild(0));