Revision: 17041 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17041 Author: campbellbarton Date: 2008-10-12 13:31:11 +0200 (Sun, 12 Oct 2008)
Log Message: ----------- in rare cases the screen cant be found for BPy's file/image selector Modified Paths: -------------- trunk/blender/source/blender/python/api2_2x/Window.c Modified: trunk/blender/source/blender/python/api2_2x/Window.c =================================================================== --- trunk/blender/source/blender/python/api2_2x/Window.c 2008-10-12 11:13:35 UTC (rev 17040) +++ trunk/blender/source/blender/python/api2_2x/Window.c 2008-10-12 11:31:11 UTC (rev 17041) @@ -577,8 +577,6 @@ "\nexpected a callback function (and optionally one or two strings) " "as argument(s)" ); - Py_INCREF(pycallback); - /* trick: we move to a spacescript because then the fileselector will properly * unset our SCRIPT_FILESEL flag when the user chooses a file or cancels the * selection. This is necessary because when a user cancels, the @@ -605,9 +603,18 @@ script->lastspace = startspace; sc->script = script; } - + + if (!script) { + /* should never happen unless we are executed + * from the BGE or somthing really strange like that */ + return EXPP_ReturnPyObjError( PyExc_AttributeError, + "Could not allocate a screen for an unknown reason." ); + } + + Py_INCREF(pycallback); + script->flags |= SCRIPT_FILESEL; - + /* clear any previous callback (nested calls to selector) */ if (script->py_browsercallback) { Py_DECREF((PyObject *)script->py_browsercallback); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs