Browse Source

Fix #2230: do not emit directly consecutive null propagation operators.

pull/2276/head
Siegfried Pammer 5 years ago
parent
commit
9932b5d9f2
  1. 5
      ICSharpCode.Decompiler/IL/Transforms/NullPropagationTransform.cs

5
ICSharpCode.Decompiler/IL/Transforms/NullPropagationTransform.cs

@ -305,6 +305,11 @@ namespace ICSharpCode.Decompiler.IL.Transforms
{ {
inst = addressOf.Value; inst = addressOf.Value;
} }
// The argument of the unwrap instruction cannot be the end of the chain, because this
// would result in two null-conditional operators immediately following each other,
// which is not valid in C#.
if (IsValidEndOfChain())
return false;
} }
else if (inst is DynamicGetMemberInstruction dynGetMember) else if (inst is DynamicGetMemberInstruction dynGetMember)
{ {

Loading…
Cancel
Save