瀏覽代碼

Fix exception when textures are not found

trethaller 7 年之前
父節點
當前提交
6bfc8d64bf
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      h3d/scene/World.hx

+ 4 - 0
h3d/scene/World.hx

@@ -176,6 +176,8 @@ class World extends Object {
 	}
 
 	function resolveSpecularTexture( path : String, mat : hxd.fmt.hmd.Data.Material) : hxd.res.Image {
+		if(mat.specularTexture == null)
+			return null;
 		try {
 			return hxd.res.Loader.currentInstance.load(mat.specularTexture).toImage();
 		} catch( e : hxd.res.NotFound ) {
@@ -184,6 +186,8 @@ class World extends Object {
 	}
 
 	function resolveNormalMap( path : String, mat : hxd.fmt.hmd.Data.Material) : hxd.res.Image {
+		if(mat.normalMap == null)
+			return null;
 		try {
 			return hxd.res.Loader.currentInstance.load(mat.normalMap).toImage();
 		} catch( e : hxd.res.NotFound ) {