소스 검색

Catch image decoding errors and show filepath

trethaller 6 년 전
부모
커밋
8c6bb374b3
1개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  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;
 	}