diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-10-21 12:30:02 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-10-21 12:30:02 +0400 |
commit | a7d7acf60178ed845aad86b4e12e2b78aec5bc6d (patch) | |
tree | 44520bc3417992139f84150317724b2f8e8e2497 /source/blender/src | |
parent | 27b90f2c66addf846a7eb0c89356b0a30965fbfb (diff) |
Bugfix:
"Warning: binarysearch_bezt_index encountered invalid array" errors were being displayed in the console. Was caused by 3d-view show-keyframe for infostring stuff, when an IPO being checked had no keyframes.
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/keyframing.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/source/blender/src/keyframing.c b/source/blender/src/keyframing.c index 79f62e38709..244c67264c3 100644 --- a/source/blender/src/keyframing.c +++ b/source/blender/src/keyframing.c @@ -1920,18 +1920,21 @@ short ipo_frame_has_keyframe (Ipo *ipo, float frame, short filter) * - this assumes that keyframes are only beztriples */ for (icu= ipo->curve.first; icu; icu= icu->next) { - /* we either include all regardless of muting, or only non-muted */ - if ((filter & ANIMFILTER_MUTED) || (icu->flag & IPO_MUTE)==0) { - short replace = -1; - int i = binarysearch_bezt_index(icu->bezt, frame, icu->totvert, &replace); - - /* binarysearch_bezt_index will set replace to be 0 or 1 - * - obviously, 1 represents a match - */ - if (replace) { - /* sanity check: 'i' may in rare cases exceed arraylen */ - if ((i >= 0) && (i < icu->totvert)) - return 1; + /* only check if there are keyframes (currently only of type BezTriple) */ + if (icu->bezt) { + /* we either include all regardless of muting, or only non-muted */ + if ((filter & ANIMFILTER_MUTED) || (icu->flag & IPO_MUTE)==0) { + short replace = -1; + int i = binarysearch_bezt_index(icu->bezt, frame, icu->totvert, &replace); + + /* binarysearch_bezt_index will set replace to be 0 or 1 + * - obviously, 1 represents a match + */ + if (replace) { + /* sanity check: 'i' may in rare cases exceed arraylen */ + if ((i >= 0) && (i < icu->totvert)) + return 1; + } } } } |