diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-02-15 03:37:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-02-15 05:46:47 +0300 |
commit | 24f9ed0b348f3dc577975d83c59f9a325840a2fe (patch) | |
tree | 2101423313d2383e7cde85dd772a4045fa0e5f6a /source/blender/python/mathutils/mathutils_Euler.c | |
parent | bf157ce9277ba1011a6e317c7629bab0dd8c36a5 (diff) |
Fix crash setting Euler.order to a non-string
Diffstat (limited to 'source/blender/python/mathutils/mathutils_Euler.c')
-rw-r--r-- | source/blender/python/mathutils/mathutils_Euler.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index edb4af0aa1d..24aca88e0f6 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -615,11 +615,14 @@ static PyObject *Euler_order_get(EulerObject *self, void *UNUSED(closure)) static int Euler_order_set(EulerObject *self, PyObject *value, void *UNUSED(closure)) { - const char *order_str = _PyUnicode_AsString(value); - short order = euler_order_from_string(order_str, "euler.order"); + const char *order_str; + short order; - if (order == -1) + if (((order_str = _PyUnicode_AsString(value)) == NULL) || + ((order = euler_order_from_string(order_str, "euler.order")) == -1)) + { return -1; + } self->order = order; (void)BaseMath_WriteCallback(self); /* order can be written back */ |