diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-07-12 10:44:57 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-07-12 10:44:57 +0400 |
commit | a4eb0d6c2f29341c9c48e4c146ce7bcde0f58fde (patch) | |
tree | e41427e870c2ae1d616683538701853137052460 /source/blender/src | |
parent | 279c5b65e274dc1c92e13e275c0ebbe2739c30ea (diff) |
Bugfix #17318: PoseLib: Crash while searching for pose typing in letter i then backspace
When searching failed to find any matches, the pointer to a matching pose was cleared. However, it wasn't reset upon clearing the invalid search-string, so a crash occurred.
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/poselib.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/src/poselib.c b/source/blender/src/poselib.c index 2d8b0c81175..fb2bfe5b605 100644 --- a/source/blender/src/poselib.c +++ b/source/blender/src/poselib.c @@ -756,6 +756,13 @@ static void poselib_keytag_pose (tPoseLib_PreviewData *pld) */ static void poselib_preview_get_next (tPoseLib_PreviewData *pld, int step) { + /* check if we no longer have search-string, but don't have any marker */ + if (pld->marker == NULL) { + if ((step) && (pld->searchstr[0] == 0)) + pld->marker= pld->act->markers.first; + } + + /* the following operations assume that there is a starting point and direction */ if ((pld->marker) && (step)) { /* search-string dictates a special approach */ if (pld->searchstr[0]) { @@ -1262,9 +1269,14 @@ void poselib_preview_poses (Object *ob, short apply_active) /* get search-string */ index= pld.search_cursor; - memcpy(&tempstr[0], &pld.searchstr[0], index); - tempstr[index]= '|'; - memcpy(&tempstr[index+1], &pld.searchstr[index], 64-index); + if (IN_RANGE(index, 0, 64)) { + memcpy(&tempstr[0], &pld.searchstr[0], index); + tempstr[index]= '|'; + memcpy(&tempstr[index+1], &pld.searchstr[index], 64-index); + } + else { + strncpy(tempstr, pld.searchstr, 64); + } /* get marker name */ if (pld.marker) |