Browse Source

Fix #862 - NullReferenceException for ExpressionBuilder.TranslateTarget

pull/863/head
Siegfried Pammer 8 years ago
parent
commit
049b5903d8
  1. 4
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

4
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -1083,7 +1083,9 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1083,7 +1083,9 @@ namespace ICSharpCode.Decompiler.CSharp
TranslatedExpression TranslateTarget(IMember member, ILInstruction target, bool nonVirtualInvocation)
{
if (!member.IsStatic) {
// If references are missing member.IsStatic might not be set correctly.
// Additionally check target for null, in order to avoid a crash.
if (!member.IsStatic && target != null) {
if (nonVirtualInvocation && target.MatchLdThis() && member.DeclaringTypeDefinition != resolver.CurrentTypeDefinition) {
return new BaseReferenceExpression()
.WithILInstruction(target)

Loading…
Cancel
Save