Skip to content

Commit cbe8dd4

Browse files
committed
Fix null check in MatchLegacySwitchOnStringWithDict
Updated the condition for `nullValueCaseBlock` to ensure it is not null and not equal to `defaultBlock`.
1 parent bada92e commit cbe8dd4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ICSharpCode.Decompiler/IL/Transforms/SwitchOnStringTransform.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ bool MatchLegacySwitchOnStringWithDict(InstructionCollection<ILInstruction> inst
668668
if (!FixCasesWithoutValue(sections, stringValues))
669669
return false;
670670
// switch contains case null:
671-
if (nullValueCaseBlock != defaultBlock)
671+
if (nullValueCaseBlock != null && nullValueCaseBlock != defaultBlock)
672672
{
673673
if (!AddNullSection(sections, stringValues, nullValueCaseBlock))
674674
{

0 commit comments

Comments
 (0)