diff --git a/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs b/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs index 12c55ae18..f45e9f4ab 100644 --- a/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs +++ b/ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs @@ -1553,7 +1553,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection object GetStaticResource(short identifier) { - int keyIndex = currentKey - 1; + int keyIndex = Math.Max(0, currentKey - 1); while (keyIndex >= 0 && !keys[keyIndex].HasStaticResources) keyIndex--; if (keyIndex >= 0 && identifier < keys[keyIndex].StaticResources.Count) diff --git a/ILSpy.BamlDecompiler/Tests/Cases/Issue445.xaml b/ILSpy.BamlDecompiler/Tests/Cases/Issue445.xaml index d6eba3b8f..1c447620d 100644 --- a/ILSpy.BamlDecompiler/Tests/Cases/Issue445.xaml +++ b/ILSpy.BamlDecompiler/Tests/Cases/Issue445.xaml @@ -1,17 +1,12 @@ - + -