Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/python/mathutils/mathutils_Vector.c')
-rw-r--r--source/blender/python/mathutils/mathutils_Vector.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c
index 5848e6e8c75..0ca8878c96a 100644
--- a/source/blender/python/mathutils/mathutils_Vector.c
+++ b/source/blender/python/mathutils/mathutils_Vector.c
@@ -174,7 +174,7 @@ static PyObject *C_Vector_Range(PyObject *cls, PyObject *args)
case 2:
if (start >= stop) {
PyErr_SetString(PyExc_RuntimeError,
- "Start value is larger"
+ "Start value is larger "
"than the stop value");
return NULL;
}
@@ -184,16 +184,27 @@ static PyObject *C_Vector_Range(PyObject *cls, PyObject *args)
default:
if (start >= stop) {
PyErr_SetString(PyExc_RuntimeError,
- "Start value is larger"
+ "Start value is larger "
"than the stop value");
return NULL;
}
- size = (stop - start)/step;
- if (size%step)
- size++;
+
+ size = (stop - start);
+
+ if ((size % step) != 0)
+ size += step;
+
+ size /= step;
+
break;
}
+ if (size < 2) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Vector(): invalid size");
+ return NULL;
+ }
+
vec = PyMem_Malloc(size * sizeof(float));
if (vec == NULL) {