Alembic import: prevent crash when cancelling import.
authorSybren A. Stüvel <sybren@stuvel.eu>
Fri, 7 Apr 2017 14:03:16 +0000 (16:03 +0200)
committerSybren A. Stüvel <sybren@stuvel.eu>
Fri, 7 Apr 2017 14:03:29 +0000 (16:03 +0200)
It's possible that cancellation occured between the creation of the reader
and the creation of the Blender object, in which case reader->object()
returns a NULL pointer.

source/blender/alembic/intern/alembic_capi.cc

index c16a20899829083d04342294eb1e8f27d95986b1..9529b370928097453677903d50a98b9e736b3ef7 100644 (file)
@@ -766,6 +766,9 @@ static void import_endjob(void *user_data)
                for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) {
                        Object *ob = (*iter)->object();
 
+                       /* It's possible that cancellation occured between the creation of
+                        * the reader and the creation of the Blender object. */
+                       if (ob == NULL) continue;
 
                        BKE_libblock_free_us(data->bmain, ob);
                }