Browse Source

Merge pull request #897 from LordJZ/patch-2

Fix crash when decompiling event add call in collection initializer
pull/900/head
Siegfried Pammer 8 years ago committed by GitHub
parent
commit
97dcfa6f9b
  1. 4
      ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs

4
ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs

@ -199,8 +199,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -199,8 +199,8 @@ namespace ICSharpCode.Decompiler.IL.Transforms
if (!IsMethodApplicable(method, call.Arguments, rootType)) goto default;
instruction = call.Arguments[0];
if (method.IsAccessor) {
var property = (IProperty)method.AccessorOwner;
var isGetter = property.Getter == method;
var property = method.AccessorOwner as IProperty;
var isGetter = property?.Getter == method;
var indices = call.Arguments.Skip(1).Take(call.Arguments.Count - (isGetter ? 1 : 2)).ToArray();
if (possibleIndexVariables != null) {
foreach (var index in indices.OfType<IInstructionWithVariableOperand>()) {

Loading…
Cancel
Save