From 50aa6e02aa09c882be10dfcba34f423a6bd34213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Wed, 4 Apr 2012 23:32:02 +0200 Subject: [PATCH] Fixed a case where extract method returned null. --- .../CodeActions/ExtractMethod/ExtractMethodAction.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ExtractMethod/ExtractMethodAction.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ExtractMethod/ExtractMethodAction.cs index 81db7e6537..43f1ff8c3b 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ExtractMethod/ExtractMethodAction.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/ExtractMethod/ExtractMethodAction.cs @@ -56,8 +56,9 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring.ExtractMethod if (!(node is Statement)) yield break; } - - yield return CreateFromStatements(context, new List (selected.OfType ())); + var action = CreateFromStatements (context, new List (selected.OfType ())); + if (action != null) + yield return action; } CodeAction CreateFromExpression(RefactoringContext context, Expression expression)