Skip to content

Commit

Permalink
Fix #1338: KeyNotFoundException in SwitchDetection.AnalyzeControlFlow()
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrunwald committed Dec 16, 2018
1 parent 1cd63f7 commit b5ab8a4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ICSharpCode.Decompiler/IL/ControlFlow/SwitchDetection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,11 @@ private bool MatchRoslynSwitchOnString()
if (!s.Value.MatchBranch(out var block))
continue;

var node = controlFlowGraph.GetNode(block);
if (!loopContext.MatchContinue(node))
caseNodes.Add(node);
if (block.Parent == currentContainer) {
var node = controlFlowGraph.GetNode(block);
if (!loopContext.MatchContinue(node))
caseNodes.Add(node);
}
}

AddNullCase(flowNodes, caseNodes);
Expand Down

0 comments on commit b5ab8a4

Please sign in to comment.