From da83509dca485b893aa76511d03a7e3aa8ff8a1f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 3 Jul 2006 05:27:29 +0000 Subject: fixed an error in DECREF'ing a variable that could have been null, also gave more helpfull error messages, thanks Theeth --- source/blender/python/api2_2x/Geometry.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source') diff --git a/source/blender/python/api2_2x/Geometry.c b/source/blender/python/api2_2x/Geometry.c index 7d6ba48ca35..df33d90a3c1 100644 --- a/source/blender/python/api2_2x/Geometry.c +++ b/source/blender/python/api2_2x/Geometry.c @@ -91,21 +91,20 @@ PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * args ) for( i = 0; i < len_polylines; ++i ) { polyLine= PySequence_GetItem( polyLineSeq, i ); - if (!PySequence_Check(polyLineSeq)) { + if (!PySequence_Check(polyLine)) { freedisplist(&dispbase); - Py_DECREF(polyLine); + Py_XDECREF(polyLine); /* may be null so use Py_XDECREF*/ return EXPP_ReturnPyObjError( PyExc_TypeError, - "expected a sequence of poly lines" ); + "One or more of the polylines is not a sequence of Mathutils.Vector's" ); } - len_polypoints= PySequence_Size( polyLine ); if (len_polypoints>0) { /* dont bother adding edges as polylines */ if (EXPP_check_sequence_consistency( polyLine, &vector_Type ) != 1) { freedisplist(&dispbase); Py_DECREF(polyLine); return EXPP_ReturnPyObjError( PyExc_TypeError, - "expected a sequence of poly lines" ); + "A point in one of the polylines is not a Mathutils.Vector type" ); } dl= MEM_callocN(sizeof(DispList), "poly disp"); @@ -147,7 +146,7 @@ PyObject *M_Geometry_PolyFill( PyObject * self, PyObject * args ) if( !tri_list ) { freedisplist(&dispbase); return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "PyList_New() failed" ); + "Geometry.PolyFill failed to make a new list" ); } index= 0; -- cgit v1.2.3