diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-07-09 09:51:19 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-07-09 09:52:08 +0400 |
commit | 02eb03f8687c30f598147082857a3b1d5dd1f007 (patch) | |
tree | 0b779e29830c422c8b12c33d1c2a16750203895b /source/blender | |
parent | 9c48ea3979f5b3f8ede7a4f830a745cf9cff2dbb (diff) |
Freestyle: fix for crash in the constructor of freestyle.types.StrokeVertexIterator.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp index 63a2541d865..2906f20be06 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; |