Browse Source

Fix #1537: KeyNotFoundException in ReduceNestingTransform.ReduceSwitchNesting()

pull/1596/head
Daniel Grunwald 7 years ago
parent
commit
ed5d71b365
  1. 2
      ICSharpCode.Decompiler/IL/Transforms/ReduceNestingTransform.cs

2
ICSharpCode.Decompiler/IL/Transforms/ReduceNestingTransform.cs

@ -216,6 +216,8 @@ namespace ICSharpCode.Decompiler.IL @@ -216,6 +216,8 @@ namespace ICSharpCode.Decompiler.IL
var defaultSection = switchInst.Sections.MaxBy(s => s.Labels.Count());
if (!defaultSection.Body.MatchBranch(out var defaultBlock) || defaultBlock.IncomingEdgeCount != 1)
return false;
if (defaultBlock.Parent != switchContainer)
return false;
// tally stats for heuristic from each case block
int maxStatements = 0, maxDepth = 0;

Loading…
Cancel
Save