Browse Source

Fix IntroduceUnsafeModifier.VisitStackAllocExpression: size expression might contain pointer type or resolve result might be null.

pull/1246/head
Siegfried Pammer 7 years ago
parent
commit
224b183e98
  1. 7
      ICSharpCode.Decompiler/CSharp/Transforms/IntroduceUnsafeModifier.cs

7
ICSharpCode.Decompiler/CSharp/Transforms/IntroduceUnsafeModifier.cs

@ -141,8 +141,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -141,8 +141,11 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
public override bool VisitStackAllocExpression(StackAllocExpression stackAllocExpression)
{
base.VisitStackAllocExpression(stackAllocExpression);
return stackAllocExpression.GetResolveResult().Type is PointerType;
bool result = base.VisitStackAllocExpression(stackAllocExpression);
var rr = stackAllocExpression.GetResolveResult();
if (rr?.Type is PointerType)
return true;
return result;
}
public override bool VisitInvocationExpression(InvocationExpression invocationExpression)

Loading…
Cancel
Save