Revision: 16149
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16149
Author:   ianwill
Date:     2008-08-17 19:11:51 +0200 (Sun, 17 Aug 2008)

Log Message:
-----------
== 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?\195?\169 (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.

Modified Paths:
--------------
    trunk/blender/source/blender/python/api2_2x/Draw.c

Modified: trunk/blender/source/blender/python/api2_2x/Draw.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Draw.c  2008-08-17 17:11:00 UTC 
(rev 16148)
+++ trunk/blender/source/blender/python/api2_2x/Draw.c  2008-08-17 17:11:51 UTC 
(rev 16149)
@@ -1554,6 +1554,12 @@
 
        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(  );


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to