[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43786] trunk/blender/source/blender/ makesrna/intern/rna_material.c: fix [#30025] Blender crash when using python to load a blend file and import an obj file

Campbell Barton ideasman42 at gmail.com
Tue Jan 31 04:55:18 CET 2012


Revision: 43786
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43786
Author:   campbellbarton
Date:     2012-01-31 03:54:51 +0000 (Tue, 31 Jan 2012)
Log Message:
-----------
fix [#30025] Blender crash when using python to load a blend file and import an obj file

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_material.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_material.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_material.c	2012-01-30 22:34:37 UTC (rev 43785)
+++ trunk/blender/source/blender/makesrna/intern/rna_material.c	2012-01-31 03:54:51 UTC (rev 43786)
@@ -93,10 +93,14 @@
 	Material *ma= ptr->id.data;
 
 	DAG_id_tag_update(&ma->id, 0);
-	if(scene->gm.matmode == GAME_MAT_GLSL)
-		WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ma);
-	else
-		WM_main_add_notifier(NC_MATERIAL|ND_SHADING, ma);
+	if (scene) {  /* can be NULL, see [#30025] */
+		if (scene->gm.matmode == GAME_MAT_GLSL) {
+			WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ma);
+		}
+		else {
+			WM_main_add_notifier(NC_MATERIAL|ND_SHADING, ma);
+		}
+	}
 }
 
 static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)



More information about the Bf-blender-cvs mailing list