Browse Source

Fix null check in MatchLegacySwitchOnStringWithDict

Updated the condition for `nullValueCaseBlock` to ensure it is not null and not equal to `defaultBlock`.
pull/3422/head
ds5678 2 months ago
parent
commit
cbe8dd43d7
  1. 2
      ICSharpCode.Decompiler/IL/Transforms/SwitchOnStringTransform.cs

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

@ -668,7 +668,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
if (!FixCasesWithoutValue(sections, stringValues)) if (!FixCasesWithoutValue(sections, stringValues))
return false; return false;
// switch contains case null: // switch contains case null:
if (nullValueCaseBlock != defaultBlock) if (nullValueCaseBlock != null && nullValueCaseBlock != defaultBlock)
{ {
if (!AddNullSection(sections, stringValues, nullValueCaseBlock)) if (!AddNullSection(sections, stringValues, nullValueCaseBlock))
{ {

Loading…
Cancel
Save