Browse Source

[material-lib] Fix crash of project has no material lib config

Clement Espeute 1 năm trước cách đây
mục cha
commit
870b907a11
1 tập tin đã thay đổi với 7 bổ sung5 xóa
  1. 7 5
      hide/view/Prefab.hx

+ 7 - 5
hide/view/Prefab.hx

@@ -218,11 +218,13 @@ class Prefab extends hide.view.FileView {
 
 		var config = hide.Config.loadForFile(ide, ide.getPath(state.path));
 		var matLibs : Array<Dynamic> = config.get("materialLibraries");
-		for (lib in matLibs) {
-			if (state.path == lib.path) {
-				matLibPath = lib.path;
-				renameMatsHistory = [];
-				break;
+		if (matLibs != null) {
+			for (lib in matLibs) {
+				if (state.path == lib.path) {
+					matLibPath = lib.path;
+					renameMatsHistory = [];
+					break;
+				}
 			}
 		}
 	}