fix for more crashes with baked fcurves

This commit is contained in:
Campbell Barton 2010-03-03 13:20:18 +00:00
parent 58bf4b1ab5
commit ca7b6e2cd0
3 changed files with 9 additions and 3 deletions

@ -372,6 +372,9 @@ void sample_fcurve (FCurve *fcu)
tempFrameValCache *value_cache, *fp; tempFrameValCache *value_cache, *fp;
int sfra, range; int sfra, range;
int i, n, nIndex; int i, n, nIndex;
if(fcu->bezt==NULL) /* ignore baked */
return NULL;
/* find selected keyframes... once pair has been found, add keyframes */ /* find selected keyframes... once pair has been found, add keyframes */
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {

@ -2912,7 +2912,7 @@ static void posttrans_fcurve_clean (FCurve *fcu)
/* allocate memory for the cache */ /* allocate memory for the cache */
// TODO: investigate using BezTriple columns instead? // TODO: investigate using BezTriple columns instead?
if (fcu->totvert == 0) if (fcu->totvert == 0 || fcu->bezt==NULL)
return; return;
selcache= MEM_callocN(sizeof(float)*fcu->totvert, "FCurveSelFrameNums"); selcache= MEM_callocN(sizeof(float)*fcu->totvert, "FCurveSelFrameNums");
len= 0; len= 0;

@ -323,10 +323,13 @@ static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer)
static int fcu_test_selected(FCurve *fcu) static int fcu_test_selected(FCurve *fcu)
{ {
BezTriple *bezt; BezTriple *bezt= fcu->bezt;
int i; int i;
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) { if(bezt==NULL) /* ignore baked */
return 0;
for (i=0; i < fcu->totvert; i++, bezt++) {
if (BEZSELECTED(bezt)) return 1; if (BEZSELECTED(bezt)) return 1;
} }