[Bf-blender-cvs] [24f9ed0] master: Fix crash setting Euler.order to a non-string

Campbell Barton noreply at git.blender.org
Sun Feb 15 04:06:08 CET 2015


Commit: 24f9ed0b348f3dc577975d83c59f9a325840a2fe
Author: Campbell Barton
Date:   Sun Feb 15 11:37:23 2015 +1100
Branches: master
https://developer.blender.org/rB24f9ed0b348f3dc577975d83c59f9a325840a2fe

Fix crash setting Euler.order to a non-string

===================================================================

M	source/blender/python/mathutils/mathutils_Euler.c

===================================================================

diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c
index edb4af0..24aca88 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 */




More information about the Bf-blender-cvs mailing list