diff --git a/source/blender/python/api2_2x/Mathutils.c b/source/blender/python/api2_2x/Mathutils.c index f36f7337808..e8bf2b49af2 100644 --- a/source/blender/python/api2_2x/Mathutils.c +++ b/source/blender/python/api2_2x/Mathutils.c @@ -465,6 +465,7 @@ PyObject *M_Mathutils_AngleBetweenVecs(PyObject * self, PyObject * args) double norm_a = 0.0f, norm_b = 0.0f; double vec_a[4], vec_b[4]; int x, size; + PyObject *test = NULL; if(!PyArg_ParseTuple(args, "O!O!", &vector_Type, &vec1, &vector_Type, &vec2)) return EXPP_ReturnPyObjError(PyExc_TypeError, @@ -473,6 +474,15 @@ PyObject *M_Mathutils_AngleBetweenVecs(PyObject * self, PyObject * args) return EXPP_ReturnPyObjError(PyExc_AttributeError, "Mathutils.AngleBetweenVecs(): expects (2) vector objects of the same size\n"); + //test to make sure that we don't have a zero vector + test = M_Mathutils_DotVecs(self, args); + if(!PyFloat_AS_DOUBLE(test)){ + Py_DECREF(test); + return EXPP_ReturnPyObjError(PyExc_AttributeError, + "Mathutils.AngleBetweenVecs(): zero-length vectors not acceptable\n"); + } + Py_DECREF(test); + //since size is the same.... size = vec1->size;