Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-02-08 17:34:23 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-08 17:34:23 +0300
commit03bdfb6f312a0259a4bf3e560bff12fb50975a55 (patch)
tree7ac7845de0ebac4e2a870e182fbb4edd82218f8f
parent12f6c667d96367bc4718de5077ef0f609c4d5ece (diff)
fix for segfault when setting handle type
-rw-r--r--source/blender/editors/animation/keyframes_edit.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index c1b2e474d52..718286b4ba4 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -89,52 +89,59 @@
*/
short ANIM_fcurve_keys_bezier_loop(BeztEditData *bed, FCurve *fcu, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb)
{
- BezTriple *bezt;
+ BezTriple *bezt;
+ int i;
/* sanity check */
if (ELEM(NULL, fcu, fcu->bezt))
return 0;
/* set the F-Curve into the editdata so that it can be accessed */
- bed->fcu= fcu;
- bed->curIndex= 0;
+ if(bed) {
+ bed->fcu= fcu;
+ bed->curIndex= 0;
+ }
/* if function to apply to bezier curves is set, then loop through executing it on beztriples */
- if (bezt_cb) {
+ if (bezt_cb) {
/* if there's a validation func, include that check in the loop
* (this is should be more efficient than checking for it in every loop)
*/
if (bezt_ok) {
- for (bed->curIndex=0, bezt=fcu->bezt; bed->curIndex < fcu->totvert; bed->curIndex++, bezt++) {
+ for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
/* Only operate on this BezTriple if it fullfills the criteria of the validation func */
+ if(bed) bed->curIndex= i;
if (bezt_ok(bed, bezt)) {
/* Exit with return-code '1' if function returns positive
* This is useful if finding if some BezTriple satisfies a condition.
*/
- if (bezt_cb(bed, bezt)) return 1;
+ if (bezt_cb(bed, bezt)) return 1;
}
}
}
else {
- for (bed->curIndex=0, bezt=fcu->bezt; bed->curIndex < fcu->totvert; bed->curIndex++, bezt++) {
+ for (bezt=fcu->bezt, i=0; i < fcu->totvert; bezt++, i++) {
/* Exit with return-code '1' if function returns positive
* This is useful if finding if some BezTriple satisfies a condition.
*/
- if (bezt_cb(bed, bezt)) return 1;
+ if(bed) bed->curIndex= i;
+ if (bezt_cb(bed, bezt)) return 1;
}
}
- }
+ }
/* unset the F-Curve from the editdata now that it's done */
- bed->fcu= NULL;
- bed->curIndex= 0;
-
- /* if fcu_cb (F-Curve post-editing callback) has been specified then execute it */
- if (fcu_cb)
- fcu_cb(fcu);
+ if(bed) {
+ bed->fcu= NULL;
+ bed->curIndex= 0;
+ }
+
+ /* if fcu_cb (F-Curve post-editing callback) has been specified then execute it */
+ if (fcu_cb)
+ fcu_cb(fcu);
/* done */
- return 0;
+ return 0;
}
/* -------------------------------- Further Abstracted (Not Exposed Directly) ----------------------------- */