Skip to content

Commit 22c9801

Browse files
Fix #2530: ArgumentOutOfRangeException in PatternMatchRefTypes
1 parent 7463010 commit 22c9801

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ICSharpCode.Decompiler/IL/Transforms/PatternMatchingTransform.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private bool PatternMatchRefTypes(Block block, BlockContainer container, ILTrans
132132
{
133133
// stloc v(ldloc s)
134134
pos--;
135-
if (!block.Instructions[pos].MatchStLoc(s, out value))
135+
if (pos < 0 || !block.Instructions[pos].MatchStLoc(s, out value))
136136
return false;
137137
if (v.Kind is not (VariableKind.Local or VariableKind.StackSlot))
138138
return false;

0 commit comments

Comments
 (0)