diff --git a/ShaderStripperVariantCollection.cs b/ShaderStripperVariantCollection.cs index 34b2ccf..10f5595 100644 --- a/ShaderStripperVariantCollection.cs +++ b/ShaderStripperVariantCollection.cs @@ -145,6 +145,19 @@ public override void Initialize(){ // Move to variants contents (skip current line, "second:" and "variants:") i += 3; + + // it's possible for the variants array to be empty (represented by `variants: []`) + if (i >= yaml.Count) { + // this was the final entry, we've reached EOF + break; + } + + if (GetYamlIndent(yaml[i]) == indent) { + // the variants array was empty and we're now on the `- first:` line of the next entry + i -= 1; // decrement here because the loop will increment + continue; + } + indent = GetYamlIndent(yaml[i]); var sv = new ShaderVariantCollection.ShaderVariant(); for (; i