소스 검색

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

Clement Espeute 1 년 전
부모
커밋
870b907a11
1개의 변경된 파일7개의 추가작업 그리고 5개의 파일을 삭제
  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;
+				}
 			}
 		}
 	}