== BPython API ==

Bug: Draw.Number wasn't properly checking that the initial, min and max values passed to it were numbers. On errors Python would set an error flag that would only be caught later on, masking where the real problem was. Pesky bug...

Reported by André (jaguarandi) on irc, thanks!

PS for bpy devs: PyInt_AsLong returns -1 on error and sets the error flag. With functions like that we need to take special care or not that obvious bugs appear.
This commit is contained in:
Willian Padovani Germano
2008-08-17 17:11:51 +00:00
parent f4d682dd2c
commit 7fd701ab58

View File

@@ -1554,6 +1554,12 @@ static PyObject *Method_Number( PyObject * self, PyObject * args )
UI_METHOD_ERRORCHECK;
if ( !PyNumber_Check(inio) || !PyNumber_Check(mino) ||
!PyNumber_Check(maxo) ) {
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected ints or floats for the initial, min and max values" );
}
but = newbutton( );
if (tip) strncpy(but->tooltip, tip, BPY_MAX_TOOLTIP);
block = Get_uiBlock( );