[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54830] branches/ge_harmony/source/blender /blenkernel/intern/shader.c: Making sure empty custom shaders don' t crash blender.

Daniel Stokes kupomail at gmail.com
Mon Feb 25 03:21:52 CET 2013


Revision: 54830
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54830
Author:   kupoman
Date:     2013-02-25 02:21:49 +0000 (Mon, 25 Feb 2013)
Log Message:
-----------
Making sure empty custom shaders don't crash blender.

Modified Paths:
--------------
    branches/ge_harmony/source/blender/blenkernel/intern/shader.c

Modified: branches/ge_harmony/source/blender/blenkernel/intern/shader.c
===================================================================
--- branches/ge_harmony/source/blender/blenkernel/intern/shader.c	2013-02-25 00:45:20 UTC (rev 54829)
+++ branches/ge_harmony/source/blender/blenkernel/intern/shader.c	2013-02-25 02:21:49 UTC (rev 54830)
@@ -126,12 +126,15 @@
 		return;
 	}
 
-	new_source = BLI_dynstr_new();
-
 	/* Find main, and assume there is nothing after it */
 	dst_main = strstr(dst->source, "void main");
 	src_main = strstr(src->source, "void main");
 
+	if (!dst_main || ! src_main)
+		return;
+
+	new_source = BLI_dynstr_new();
+
 	/* Put the fluff into the new shader */
 	BLI_dynstr_nappend(new_source, dst->source, dst_main-dst->source);
 	BLI_dynstr_nappend(new_source, src->source, src_main-src->source);




More information about the Bf-blender-cvs mailing list