Skip to content

Commit

Permalink
don't load invalid definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
al2me6 committed Jul 27, 2024
1 parent 05fb97d commit 093c542
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions Source/MaterialDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ public static void Load()

foreach (var node in GameDatabase.Instance.GetConfigNodes("SHABBY_MATERIAL_DEF")) {
var def = new MaterialDef(node);
if (string.IsNullOrEmpty(def.name)) {
Debug.LogError("[Shabby] material definition must have a valid name");
} else {
if (string.IsNullOrEmpty(def.name) || !def.isValid) {
Debug.LogError($"[Shabby][MaterialDef {def.name}] removing invalid definition");
}
else {
items[def.name] = def;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/MaterialReplacement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void Postfix(ref GameObject __result, ConfigNode partCfg)
foreach (ConfigNode node in partCfg.nodes) {
if (node.name != replacementNodeName) continue;
var replacement = new MaterialReplacement(node);
if (replacement.materialDef?.isValid == true) replacements.Add(replacement);
if (replacement.materialDef != null) replacements.Add(replacement);
}

// Apply blanket replacements or material name replacements.
Expand Down

0 comments on commit 093c542

Please sign in to comment.