diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-01-29 07:03:49 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-01-29 07:12:57 +0300 |
commit | a57d9f725f6e4c565163acb1e57f5417a665c9dd (patch) | |
tree | ef0c06e898d6e76cf1d78cbbb058e904da28b51c /source/blender/editors/transform/transform_input.c | |
parent | cd6178e5849586f791bd94e51d0e9272cd3da1ad (diff) |
Fix crash running transform in background mode
Diffstat (limited to 'source/blender/editors/transform/transform_input.c')
-rw-r--r-- | source/blender/editors/transform/transform_input.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index f55127fd4ec..9b7d19eacd5 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -88,9 +88,10 @@ static void InputTrackBall(TransInfo *UNUSED(t), MouseInput *mi, const double mv static void InputHorizontalRatio(TransInfo *t, MouseInput *UNUSED(mi), const double mval[2], float output[3]) { - const double pad = t->ar->winx / 10; + const int winx = t->ar ? t->ar->winx : 1; + const double pad = winx / 10; - output[0] = (mval[0] - pad) / (t->ar->winx - 2 * pad); + output[0] = (mval[0] - pad) / (winx - 2 * pad); } static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const double mval[2], float output[3]) @@ -105,9 +106,10 @@ static void InputHorizontalAbsolute(TransInfo *t, MouseInput *mi, const double m static void InputVerticalRatio(TransInfo *t, MouseInput *UNUSED(mi), const double mval[2], float output[3]) { - const double pad = t->ar->winy / 10; + const int winy = t->ar ? t->ar->winy : 1; + const double pad = winy / 10; - output[0] = (mval[1] - pad) / (t->ar->winy - 2 * pad); + output[0] = (mval[1] - pad) / (winy - 2 * pad); } static void InputVerticalAbsolute(TransInfo *t, MouseInput *mi, const double mval[2], float output[3]) |