fix for crash drawing zero length motion path and a leak with zero length paths.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 20 Jun 2011 17:50:59 +0000 (17:50 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 20 Jun 2011 17:50:59 +0000 (17:50 +0000)
source/blender/blenkernel/intern/anim.c
source/blender/editors/space_view3d/drawanimviz.c

index 1763866c00032a72a0c1c32a019a071eb8d04352..0747d87a0ab2c7a096e71ba1c40acaf085a6cd16 100644 (file)
@@ -171,7 +171,12 @@ bMotionPath *animviz_verify_motionpaths(Scene *scene, Object *ob, bPoseChannel *
                avs= &ob->avs;
                dst= &ob->mpath;
        }
-       
+
+       /* avoid 0 size allocs */
+       if(avs->path_sf >= avs->path_ef) {
+               return NULL;
+       }
+
        /* if there is already a motionpath, just return that,
         * but provided it's settings are ok 
         */
index ee78fd92b79a5e61dfff8edf0046af3db4813472..aa3ba1a306214ce657a3cc07b6fbb7d9d4c6ff6b 100644 (file)
@@ -117,7 +117,11 @@ void draw_motion_path_instance(Scene *scene,
                len = mpath->length;
                mpv_start= mpath->points;
        }
-       
+
+       if(len <= 0) {
+               return;
+       }
+
        /* draw curve-line of path */
        glShadeModel(GL_SMOOTH);