Fix use of uninitialized variable in some cases, in recent bugfix.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 14 Aug 2018 13:27:25 +0000 (15:27 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Tue, 14 Aug 2018 13:27:49 +0000 (15:27 +0200)
source/blender/editors/object/object_add.c

index 8fc2d419c3ce0c64a005c9c155864ea21d2ae4d0..efc69c36cc38a39670e3297667cf4a0b6b835e03 100644 (file)
@@ -1621,7 +1621,7 @@ static int convert_exec(bContext *C, wmOperator *op)
        Main *bmain = CTX_data_main(C);
        Scene *scene = CTX_data_scene(C);
        Base *basen = NULL, *basact = NULL;
-       Object *ob, *ob1, *newob, *obact = CTX_data_active_object(C);
+       Object *ob, *ob1, *obact = CTX_data_active_object(C);
        DerivedMesh *dm;
        Curve *cu;
        Nurb *nu;
@@ -1689,6 +1689,7 @@ static int convert_exec(bContext *C, wmOperator *op)
        }
 
        for (CollectionPointerLink *link = selected_editable_bases.first; link; link = link->next) {
+               Object *newob = NULL;
                Base *base = link->ptr.data;
                ob = base->object;
 
@@ -1904,7 +1905,9 @@ static int convert_exec(bContext *C, wmOperator *op)
                }
 
                /* Ensure new object has consistent material data with its new obdata. */
-               test_object_materials(bmain, newob, newob->data);
+               if (newob) {
+                       test_object_materials(bmain, newob, newob->data);
+               }
 
                /* tag obdata if it was been changed */