Fix #31748: Blender crashes when typing "al" after opening spacebar menu.
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 8 Jun 2012 08:24:08 +0000 (08:24 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 8 Jun 2012 08:24:08 +0000 (08:24 +0000)
Crash was introduced by own refactoring of poll functions in clip editor.

source/blender/editors/space_clip/tracking_ops.c

index fdd4dfc57d082680dde84867a1a6965f4c777eff..f3a96ef7a79039b8a5e1544d0b5e47b5d7549226 100644 (file)
@@ -2135,17 +2135,20 @@ static Object *get_orientation_object(bContext *C)
 
 static int set_orientation_poll(bContext *C)
 {
-       Scene *scene = CTX_data_scene(C);
        SpaceClip *sc = CTX_wm_space_clip(C);
-       MovieClip *clip = ED_space_clip(sc);
-       MovieTracking *tracking = &clip->tracking;
-       MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
 
-       if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
-               return TRUE;
-       }
-       else {
-               return OBACT != NULL;
+       if (sc) {
+               Scene *scene = CTX_data_scene(C);
+               MovieClip *clip = ED_space_clip(sc);
+               MovieTracking *tracking = &clip->tracking;
+               MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
+
+               if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
+                       return TRUE;
+               }
+               else {
+                       return OBACT != NULL;
+               }
        }
 
        return FALSE;
@@ -2744,11 +2747,16 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
 static int set_solution_scale_poll(bContext *C)
 {
        SpaceClip *sc = CTX_wm_space_clip(C);
-       MovieClip *clip = ED_space_clip(sc);
-       MovieTracking *tracking = &clip->tracking;
-       MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
 
-       return (tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0;
+       if (sc) {
+               MovieClip *clip = ED_space_clip(sc);
+               MovieTracking *tracking = &clip->tracking;
+               MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
+
+               return (tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0;
+       }
+
+       return FALSE;
 }
 
 static int set_solution_scale_exec(bContext *C, wmOperator *op)