Alembic: Fix T52579: crash when replacing slightly different alembic files
authorSybren A. Stüvel <sybren@stuvel.eu>
Tue, 29 Aug 2017 14:58:13 +0000 (16:58 +0200)
committerSybren A. Stüvel <sybren@stuvel.eu>
Tue, 29 Aug 2017 14:58:13 +0000 (16:58 +0200)
Apparently with Maya in a certain configuration, it's possible to have an
Alembic object without schema in the Alembic file. This is now handled
properly, instead of crashing on a null pointer.

source/blender/alembic/intern/abc_util.cc
source/blender/alembic/intern/alembic_capi.cc

index 26eb7620fb166efb6265dfe67b64804b8f9332fc..24a508e82926d00317c3c26de03f5f0d241f5e7a 100644 (file)
@@ -370,10 +370,10 @@ AbcObjectReader *create_reader(const Alembic::AbcGeom::IObject &object, ImportSe
                reader = new AbcCurveReader(object, settings);
        }
        else {
-               std::cerr << "Alembic: unknown how to handle objects of schema "
+               std::cerr << "Alembic: unknown how to handle objects of schema '"
                          << md.get("schemaObjTitle")
-                         << ", skipping object "
-                         << object.getFullName() << std::endl;
+                         << "', skipping object '"
+                         << object.getFullName() << "'" << std::endl;
        }
 
        return reader;
index bee8e92e96977aec34aec357993df8ada0969874..5503dcb15272de4ab2a607fc7afedd32b0266227 100644 (file)
@@ -990,6 +990,10 @@ CacheReader *CacheReader_open_alembic_object(AbcArchiveHandle *handle, CacheRead
 
        ImportSettings settings;
        AbcObjectReader *abc_reader = create_reader(iobject, settings);
+       if (abc_reader == NULL) {
+               /* This object is not supported */
+               return NULL;
+       }
        abc_reader->object(object);
        abc_reader->incref();