Skip to content

Commit

Permalink
Fix #2530: ArgumentOutOfRangeException in PatternMatchRefTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
siegfriedpammer committed Nov 6, 2021
1 parent 7463010 commit 22c9801
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private bool PatternMatchRefTypes(Block block, BlockContainer container, ILTrans
{
// stloc v(ldloc s)
pos--;
if (!block.Instructions[pos].MatchStLoc(s, out value))
if (pos < 0 || !block.Instructions[pos].MatchStLoc(s, out value))
return false;
if (v.Kind is not (VariableKind.Local or VariableKind.StackSlot))
return false;
Expand Down

0 comments on commit 22c9801

Please sign in to comment.