diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-17 10:29:56 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-09-17 10:29:56 +0300 |
commit | e40dc53c44573a454b8069774d89b4770b23ea82 (patch) | |
tree | fb4fd8bed97b180230c7e09b84a06ff279a9e983 /source/blender/editors/space_clip | |
parent | 2b1e0c038cb083a547969ccca5d4c0e96878d21a (diff) |
Fix T69960: Track path tries to draw negative point counts
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 9476a9eeadd..21a9285c0f3 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -507,7 +507,16 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin /* Collect path information. */ const int num_points_before = track_to_path_segment(sc, track, -1, path); const int num_points_after = track_to_path_segment(sc, track, 1, path); - const int num_all_points = num_points_before + num_points_after - 1; + if (num_points_before == 0 && num_points_after == 0) { + return; + } + + int num_all_points = num_points_before + num_points_after; + /* If both leading and trailing parts of the path are there the center point is counted twice. */ + if (num_points_before != 0 && num_points_after != 0) { + num_all_points -= 1; + } + const int path_start_index = count - num_points_before + 1; const int path_center_index = count; |