[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21717] branches/blender2.5/blender/source /blender/python/generic/bpy_internal_import.c: Added error prints if the text's main is not set.

Campbell Barton ideasman42 at gmail.com
Mon Jul 20 13:30:27 CEST 2009


Revision: 21717
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21717
Author:   campbellbarton
Date:     2009-07-20 13:30:27 +0200 (Mon, 20 Jul 2009)

Log Message:
-----------
Added error prints if the text's main is not set.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/python/generic/bpy_internal_import.c

Modified: branches/blender2.5/blender/source/blender/python/generic/bpy_internal_import.c
===================================================================
--- branches/blender2.5/blender/source/blender/python/generic/bpy_internal_import.c	2009-07-20 10:43:41 UTC (rev 21716)
+++ branches/blender2.5/blender/source/blender/python/generic/bpy_internal_import.c	2009-07-20 11:30:27 UTC (rev 21717)
@@ -66,7 +66,10 @@
 	
 	*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 @@
 //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 */





More information about the Bf-blender-cvs mailing list