Browse Source

bugfix for cpp

Nicolas Cannasse 10 năm trước cách đây
mục cha
commit
cad8069503
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      h3d/impl/GlDriver.hx

+ 2 - 1
h3d/impl/GlDriver.hx

@@ -139,7 +139,8 @@ class GlDriver extends Driver {
 		gl.compileShader(s);
 		if( gl.getShaderParameter(s, GL.COMPILE_STATUS) != cast 1 ) {
 			var log = gl.getShaderInfoLog(s);
-			var line = code.split("\n")[Std.parseInt(log.substr(9)) - 1];
+			var lid = Std.parseInt(log.substr(9));
+			var line = lid == null ? null : code.split("\n")[lid - 1];
 			if( line == null ) line = "" else line = "(" + StringTools.trim(line) + ")";
 			throw "An error occurred compiling the shaders: " + log + line;
 		}