Fix T47217: Crash when tracking specific scene
authorSergey Sharybin <sergey.vfx@gmail.com>
Sun, 24 Jan 2016 18:38:24 +0000 (23:38 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sun, 24 Jan 2016 18:49:47 +0000 (23:49 +0500)
source/blender/blenkernel/intern/tracking_util.c

index 1cbfc5eb834f071b2818a3467202bc4fc2ecb582..078aaf180143710ca0de3ef0999bd6028e3677d2 100644 (file)
@@ -482,7 +482,18 @@ MovieTrackingMarker *tracking_get_keyframed_marker(MovieTrackingTrack *track,
                         * fallback to the first marker in current tracked segment
                         * as a keyframe.
                         */
-                       if (next_marker && next_marker->flag & MARKER_DISABLED) {
+                       if (next_marker == NULL) {
+                               /* Could happen when trying to get reference marker for the fist
+                                * one on the segment which isn't surrounded by disabled markers.
+                                *
+                                * There's no really good choise here, just use the reference
+                                * marker which looks correct..
+                                */
+                               if (marker_keyed_fallback == NULL) {
+                                       marker_keyed_fallback = cur_marker;
+                               }
+                       }
+                       else if (next_marker->flag & MARKER_DISABLED) {
                                if (marker_keyed_fallback == NULL)
                                        marker_keyed_fallback = cur_marker;
                        }