Revision: 22099
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22099
Author: kjym3
Date: 2009-08-01 01:16:38 +0200 (Sat, 01 Aug 2009)
Log Message:
-----------
Added boundary checking to Iterator::increment() and Iterator::decrement()
to avoid an immediate crash. Now these methods raise a RuntimeError when
the iteration is already at the end.
Modified Paths:
--------------
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
Modified:
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
===================================================================
---
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
2009-07-31 23:15:00 UTC (rev 22098)
+++
branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
2009-07-31 23:16:38 UTC (rev 22099)
@@ -209,12 +209,20 @@
PyObject * Iterator_increment(BPy_Iterator* self) {
+ if (self->it->isEnd()) {
+ PyErr_SetString(PyExc_RuntimeError , "cannot increment any
more");
+ return NULL;
+ }
self->it->increment();
Py_RETURN_NONE;
}
PyObject * Iterator_decrement(BPy_Iterator* self) {
+ if (self->it->isBegin()) {
+ PyErr_SetString(PyExc_RuntimeError , "cannot decrement any
more");
+ return NULL;
+ }
self->it->decrement();
Py_RETURN_NONE;
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs