[Bf-blender-cvs] [a57d9f7] master: Fix crash running transform in background mode
Campbell Barton
noreply at git.blender.org
Fri Jan 29 05:20:46 CET 2016
Commit: a57d9f725f6e4c565163acb1e57f5417a665c9dd
Author: Campbell Barton
Date: Fri Jan 29 15:03:49 2016 +1100
Branches: master
https://developer.blender.org/rBa57d9f725f6e4c565163acb1e57f5417a665c9dd
Fix crash running transform in background mode
===================================================================
M source/blender/editors/transform/transform_input.c
===================================================================
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index f55127f..9b7d19e 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])
More information about the Bf-blender-cvs
mailing list