Browse Source

Fix #1489: ArgumentNullException in SwitchOnStringTransform.SimplifyCascadingIfStatements

pull/1505/head
Siegfried Pammer 6 years ago
parent
commit
edcf4931d0
  1. 3
      ICSharpCode.Decompiler/IL/Transforms/SwitchOnStringTransform.cs

3
ICSharpCode.Decompiler/IL/Transforms/SwitchOnStringTransform.cs

@ -179,7 +179,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms
// Newer versions of Roslyn use extra variables:
if (i >= 2 && switchValue.MatchLdLoc(out var otherSwitchValueVar) && otherSwitchValueVar.IsSingleDefinition && otherSwitchValueVar.LoadCount == 1
&& instructions[i - 2].MatchStLoc(otherSwitchValueVar, out switchValue)) {
&& instructions[i - 2].MatchStLoc(otherSwitchValueVar, out var newSwitchValue)) {
switchValue = newSwitchValue;
extraLoad = true;
}
} else if (instructions[i - 1] is StLoc stloc) {

Loading…
Cancel
Save