浏览代码

Catch Image watch callback error.

clementlandrin 11 月之前
父节点
当前提交
e2d5d35022
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      hxd/res/Image.hx

+ 8 - 2
hxd/res/Image.hx

@@ -508,10 +508,16 @@ class Image extends Resource {
 	}
 
 	function watchCallb() {
-		var w = inf.width, h = inf.height;
+		var prevInfo = inf;
 		inf = null;
+		try {
+			getInfo();
+		} catch ( e : Dynamic ) {
+			inf = prevInfo;
+			return;
+		}
 		var s = getSize();
-		if (w != s.width || h != s.height)
+		if (prevInfo.width != s.width || prevInfo.height != s.height)
 			tex.resize(s.width, s.height);
 		tex.realloc = null;
 		loadTexture();