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

Loading…
Cancel
Save