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 43e6cab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion Source/MaterialDef.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ public static void Load()
var def = new MaterialDef(node);
if (string.IsNullOrEmpty(def.name)) {
Debug.LogError("[Shabby] material definition must have a valid name");
} else {
} else if (!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 43e6cab

Please sign in to comment.