From 8bf9a8cb1e18dc784835db5fd869ad14469053a5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 20 Jul 2009 11:30:27 +0000 Subject: Added error prints if the text's main is not set. --- source/blender/python/generic/bpy_internal_import.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source/blender/python/generic/bpy_internal_import.c') diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c index b8c17d71ac4..733576146b7 100644 --- a/source/blender/python/generic/bpy_internal_import.c +++ b/source/blender/python/generic/bpy_internal_import.c @@ -66,7 +66,10 @@ PyObject *bpy_text_import( char *name, int *found ) *found= 0; - if(!maggie) return NULL; + if(!maggie) { + printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n"); + return NULL; + } if (namelen>21-3) return NULL; /* we know this cant be importable, the name is too long for blender! */ @@ -114,6 +117,11 @@ PyObject *bpy_text_reimport( PyObject *module, int *found ) //XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main; Main *maggie= bpy_import_main; + if(!maggie) { + printf("ERROR: bpy_import_main_set() was not called before running python. this is a bug.\n"); + return NULL; + } + *found= 0; /* get name, filename from the module itself */ -- cgit v1.2.3