Explorar o código

Catch image decoding errors and show filepath

trethaller %!s(int64=6) %!d(string=hai) anos
pai
achega
8c6bb374b3
Modificáronse 1 ficheiros con 7 adicións e 3 borrados
  1. 7 3
      hide/comp/Scene.hx

+ 7 - 3
hide/comp/Scene.hx

@@ -395,9 +395,13 @@ class Scene extends Component implements h3d.IDrawable {
 			hxd.res.Any.fromBytes(path, bytes);
 		};
 		if( onReady == null ) onReady = function(_) {};
-		t = loadTextureData(res.toImage(), onReady, t);
-		t.name = ide.makeRelative(path);
-		texCache.set(path, t);
+		try {
+			t = loadTextureData(res.toImage(), onReady, t);
+			t.name = ide.makeRelative(path);
+			texCache.set(path, t);
+		} catch( error : Dynamic ) {
+			throw "Could not load texure " + texturePath + ":\n" + Std.string(error);
+		};
 		return t;
 	}