Fixed crash when trying to perform transformation in Clip Editor without clip opened
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 25 Jun 2012 19:48:05 +0000 (19:48 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 25 Jun 2012 19:48:05 +0000 (19:48 +0000)
Reported by JumboCoDeC in IRC. Thanks for the report.

source/blender/editors/space_clip/clip_editor.c
source/blender/editors/transform/transform_conversions.c

index b57b16707d42b7c76e061239e1341b7a0de64990..224a250fe4c9db925af5d2df35912154d7ba786a 100644 (file)
@@ -177,6 +177,13 @@ void ED_space_clip_get_aspect_dimension_aware(SpaceClip *sc, float *aspx, float
         * mainly this is sued for transformation stuff
         */
 
+       if (!sc->clip) {
+               *aspx = 1.0f;
+               *aspy = 1.0f;
+
+               return;
+       }
+
        ED_space_clip_get_aspect(sc, aspx, aspy);
        BKE_movieclip_get_size(sc->clip, &sc->user, &w, &h);
 
index e924ce15286658a87a0cfcef86df84776e962179..dcc876b60265843dc307dba1f446da24de9a8abe 100644 (file)
@@ -5913,9 +5913,12 @@ static void createTransTrackingData(bContext *C, TransInfo *t)
 
        t->total = 0;
 
+       if (!clip)
+               return;
+
        BKE_movieclip_get_size(clip, &sc->user, &width, &height);
 
-       if (!clip || width == 0 || height == 0)
+       if (width == 0 || height == 0)
                return;
 
        if (ar->regiontype == RGN_TYPE_PREVIEW) {