Bugfix [#33268] Crash when delete all or segment from curve with SplineIK
authorJoshua Leung <aligorith@gmail.com>
Thu, 22 Nov 2012 23:19:15 +0000 (23:19 +0000)
committerJoshua Leung <aligorith@gmail.com>
Thu, 22 Nov 2012 23:19:15 +0000 (23:19 +0000)
Path rebuild may fail after certain editing operations. Instead of blindly
assuming that path rebuilds will always succeed, we now give up trying to
evaluate in case of failure.

source/blender/blenkernel/intern/armature.c

index b3cbc1f2b1663a1452297034116d2cbcb3b06fc4..1970df54339ae141ffda93d541729f1e2a79dc5b 100644 (file)
@@ -1822,8 +1822,15 @@ static void splineik_init_tree_from_pchan(Scene *scene, Object *UNUSED(ob), bPos
                 */
 
                /* only happens on reload file, but violates depsgraph still... fix! */
-               if ((cu->path == NULL) || (cu->path->data == NULL))
+               if (ELEM(NULL, cu->path, cu->path->data)) {
                        BKE_displist_make_curveTypes(scene, ikData->tar, 0);
+                       
+                       /* path building may fail in EditMode after removing verts [#33268]*/
+                       if (ELEM(NULL, cu->path, cu->path->data)) {
+                               /* BLI_assert(cu->path != NULL); */
+                               return;
+                       }
+               }
        }
 
        /* find the root bone and the chain of bones from the root to the tip