diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-07-12 15:51:21 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-07-12 15:51:21 +0400 |
commit | bfb9603cb47e524439d76f1ec303423b8ab8e9c3 (patch) | |
tree | f56bb85b85e262d918c7938073f98c0b6cb3ea9c /source/blender/python/api2_2x/gen_utils.c | |
parent | e7c15b97e24c1923df8bef96ac35f9abd17c7964 (diff) |
From stable
Revision: 11237
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11237
Author: campbellbarton
Date: 2007-07-12 13:05:31 +0200 (Thu, 12 Jul 2007)
Log Message:
-----------
PyObject_IsTrue was missing a check for an error return value in many cases.
Diffstat (limited to 'source/blender/python/api2_2x/gen_utils.c')
-rw-r--r-- | source/blender/python/api2_2x/gen_utils.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/python/api2_2x/gen_utils.c b/source/blender/python/api2_2x/gen_utils.c index 2df72136dbb..b1525e103e9 100644 --- a/source/blender/python/api2_2x/gen_utils.c +++ b/source/blender/python/api2_2x/gen_utils.c @@ -828,23 +828,27 @@ PyObject *EXPP_getBitfield( void *param, int setting, char type ) int EXPP_setBitfield( PyObject * value, void *param, int setting, char type ) { - int flag = PyObject_IsTrue( value ); + int param_bool = PyObject_IsTrue( value ); + if( param_bool == -1 ) + return EXPP_ReturnIntError( PyExc_TypeError, + "expected True/False or 0/1" ); + switch ( type ) { case 'b': - if ( flag ) + if ( param_bool ) *(char *)param |= setting; else *(char *)param &= ~setting; return 0; case 'h': - if ( flag ) + if ( param_bool ) *(short *)param |= setting; else *(short *)param &= ~setting; return 0; case 'i': - if ( flag ) + if ( param_bool ) *(int *)param |= setting; else *(int *)param &= ~setting; |