Skip to content

Commit 6aaa3c1

Browse files
committed
fixed possible NullReferenceException in extract method refactoring when local variable has no AsTypeClauseContext
1 parent 92ae0fe commit 6aaa3c1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

RetailCoder.VBE/UI/Refactorings/ExtractMethod/ExtractMethodPresenter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ private string GetExtractedMethod()
201201
.Select(e => " " + Tokens.Dim + ' ' + e.ambiguousIdentifier().GetText() +
202202
(e.LPAREN() == null
203203
? string.Empty
204-
: e.LPAREN().GetText() + (e.subscripts() == null ? string.Empty : e.subscripts().GetText()) + e.RPAREN().GetText()) + ' ' + e.asTypeClause().GetText());
204+
: e.LPAREN().GetText() + (e.subscripts() == null ? string.Empty : e.subscripts().GetText()) + e.RPAREN().GetText()) + ' ' +
205+
(e.asTypeClause() == null ? string.Empty : e.asTypeClause().GetText()));
205206
var locals = string.Join(newLine, localConsts.Union(localVariables)
206207
.Where(local => !_selectedCode.Contains(local)).ToArray()) + newLine;
207208

0 commit comments

Comments
 (0)