diff --git a/Source/MaterialDef.cs b/Source/MaterialDef.cs index 0745ea9..8a9c314 100644 --- a/Source/MaterialDef.cs +++ b/Source/MaterialDef.cs @@ -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; } } diff --git a/Source/MaterialReplacement.cs b/Source/MaterialReplacement.cs index 897087c..3cbb9a5 100644 --- a/Source/MaterialReplacement.cs +++ b/Source/MaterialReplacement.cs @@ -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.