Kaynağa Gözat

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

Clement Espeute 1 yıl önce
ebeveyn
işleme
870b907a11
1 değiştirilmiş dosya ile 7 ekleme ve 5 silme
  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;
+				}
 			}
 		}
 	}