Alembic: fix crash accessing invalid objects.
authorKévin Dietrich <kevin.dietrich@mailoo.org>
Fri, 19 Aug 2016 03:22:35 +0000 (05:22 +0200)
committerKévin Dietrich <kevin.dietrich@mailoo.org>
Fri, 19 Aug 2016 03:22:46 +0000 (05:22 +0200)
source/blender/alembic/intern/abc_util.h

index 8cdfe21e43f50ac5828d39d7c5f6fa2babf4d747..648570f5f27953a85063bd3b16940944cb4b7fd4 100644 (file)
@@ -86,8 +86,11 @@ void get_min_max_time(const Alembic::AbcGeom::IObject &object, const Schema &sch
 {
        get_min_max_time_ex(schema, min, max);
 
-       Alembic::AbcGeom::IXform parent(object.getParent(), Alembic::AbcGeom::kWrapExisting);
-       get_min_max_time_ex(parent.getSchema(), min, max);
+       const Alembic::AbcGeom::IObject &parent = object.getParent();
+       if (parent.valid() && Alembic::AbcGeom::IXform::matches(parent.getMetaData())) {
+               Alembic::AbcGeom::IXform xform(parent, Alembic::AbcGeom::kWrapExisting);
+               get_min_max_time_ex(xform.getSchema(), min, max);
+       }
 }
 
 bool has_property(const Alembic::Abc::ICompoundProperty &prop, const std::string &name);