Fix #37092 and #37381: crashes in the .object() method of Freestyle iterators.

Now the method checks if the iterator is at the end, and returns None if that is the case.
This commit is contained in:
2013-11-12 02:28:26 +00:00
parent 59e4600526
commit ef1bc03fce
6 changed files with 12 additions and 0 deletions

View File

@@ -115,6 +115,8 @@ PyDoc_STRVAR(AdjacencyIterator_object_doc,
static PyObject *AdjacencyIterator_object_get(BPy_AdjacencyIterator *self, void *UNUSED(closure))
{
if (self->a_it->isEnd())
Py_RETURN_NONE;
ViewEdge *ve = self->a_it->operator*();
if (ve)
return BPy_ViewEdge_from_ViewEdge(*ve);

View File

@@ -175,6 +175,8 @@ PyDoc_STRVAR(ChainingIterator_object_doc,
static PyObject *ChainingIterator_object_get(BPy_ChainingIterator *self, void *UNUSED(closure))
{
if (self->c_it->isEnd())
Py_RETURN_NONE;
ViewEdge *ve = self->c_it->operator*();
if (ve)
return BPy_ViewEdge_from_ViewEdge(*ve);

View File

@@ -97,6 +97,8 @@ PyDoc_STRVAR(CurvePointIterator_object_doc,
static PyObject *CurvePointIterator_object_get(BPy_CurvePointIterator *self, void *UNUSED(closure))
{
if (self->cp_it->isEnd())
Py_RETURN_NONE;
return BPy_CurvePoint_from_CurvePoint(self->cp_it->operator*());
}

View File

@@ -123,6 +123,8 @@ PyDoc_STRVAR(Interface0DIterator_object_doc,
static PyObject *Interface0DIterator_object_get(BPy_Interface0DIterator *self, void *UNUSED(closure))
{
if (self->if0D_it->isEnd())
Py_RETURN_NONE;
return Any_BPy_Interface0D_from_Interface0D(self->if0D_it->operator*());
}

View File

@@ -122,6 +122,8 @@ PyDoc_STRVAR(ViewEdgeIterator_object_doc,
static PyObject *ViewEdgeIterator_object_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure))
{
if (!self->ve_it->isEnd())
Py_RETURN_NONE;
ViewEdge *ve = self->ve_it->operator*();
if (ve)
return BPy_ViewEdge_from_ViewEdge(*ve);

View File

@@ -103,6 +103,8 @@ PyDoc_STRVAR(orientedViewEdgeIterator_object_doc,
static PyObject *orientedViewEdgeIterator_object_get(BPy_orientedViewEdgeIterator *self, void *UNUSED(closure))
{
if (self->ove_it->isEnd())
Py_RETURN_NONE;
return BPy_directedViewEdge_from_directedViewEdge(self->ove_it->operator*());
}