[Bf-blender-cvs] [02eb03f] master: Freestyle: fix for crash in the constructor of freestyle.types.StrokeVertexIterator.
Tamito Kajiyama
noreply at git.blender.org
Wed Jul 9 08:03:44 CEST 2014
Commit: 02eb03f8687c30f598147082857a3b1d5dd1f007
Author: Tamito Kajiyama
Date: Wed Jul 9 14:51:19 2014 +0900
https://developer.blender.org/rB02eb03f8687c30f598147082857a3b1d5dd1f007
Freestyle: fix for crash in the constructor of freestyle.types.StrokeVertexIterator.
===================================================================
M source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
===================================================================
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
index 63a2541..2906f20 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
@@ -68,23 +68,25 @@ static int StrokeVertexIterator_init(BPy_StrokeVertexIterator *self, PyObject *a
static const char *kwlist_2[] = {"stroke", NULL};
PyObject *brother = 0, *stroke = 0;
- if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &StrokeVertexIterator_Type, &brother)) {
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_1, &StrokeVertexIterator_Type, &brother)) {
self->sv_it = new StrokeInternal::StrokeVertexIterator(*(((BPy_StrokeVertexIterator *)brother)->sv_it));
self->reversed = ((BPy_StrokeVertexIterator *)brother)->reversed;
self->at_start = ((BPy_StrokeVertexIterator *)brother)->at_start;
}
- else if (PyErr_Clear(),
- PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_2, &Stroke_Type, &stroke))
+ else if (PyErr_Clear(),
+ PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_2, &Stroke_Type, &stroke))
{
- self->sv_it = new StrokeInternal::StrokeVertexIterator(((BPy_Stroke *)stroke)->s->strokeVerticesBegin());
+ if (!stroke)
+ self->sv_it = new StrokeInternal::StrokeVertexIterator();
+ else
+ self->sv_it = new StrokeInternal::StrokeVertexIterator(((BPy_Stroke *)stroke)->s->strokeVerticesBegin());
self->reversed = false;
self->at_start = true;
}
else {
- self->sv_it = new StrokeInternal::StrokeVertexIterator();
- self->reversed = false;
- self->at_start = true;
+ PyErr_SetString(PyExc_TypeError, "argument 1 must be StrokeVertexIterator or Stroke");
+ return -1;
}
self->py_it.it = self->sv_it;
return 0;
More information about the Bf-blender-cvs
mailing list