From b49478608800b70c3800b07c78674c0346b72b2b Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Thu, 24 Feb 2011 19:12:35 +0100 Subject: [PATCH] Fix crash in ILInlining. --- ICSharpCode.Decompiler/ILAst/ILInlining.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ICSharpCode.Decompiler/ILAst/ILInlining.cs b/ICSharpCode.Decompiler/ILAst/ILInlining.cs index 75910a7d1..6337eb032 100644 --- a/ICSharpCode.Decompiler/ILAst/ILInlining.cs +++ b/ICSharpCode.Decompiler/ILAst/ILInlining.cs @@ -68,6 +68,10 @@ namespace Decompiler /// true = found; false = cannot continue search; null = not found static bool? FindLoadInNext(ILExpression expr, ILVariable v, out ILExpression parent, out int pos) { + parent = null; + pos = 0; + if (expr == null) + return false; for (int i = 0; i < expr.Arguments.Count; i++) { ILExpression arg = expr.Arguments[i]; if (arg.Code == ILCode.Ldloc && arg.Operand == v) { @@ -79,8 +83,6 @@ namespace Decompiler if (r != null) return r; } - parent = null; - pos = 0; return IsWithoutSideEffects(expr.Code) ? (bool?)null : false; }