1
0
Fork 0

Check if node has parent

pull/357/head
Felix Becker 2017-06-09 13:32:02 +02:00
parent a1ae0f6e48
commit bc5717ab79
1 changed files with 5 additions and 2 deletions

View File

@ -127,8 +127,11 @@ class CompletionProvider
$node = $doc->getNodeAtPosition($pos);
$offset = $node === null ? -1 : $pos->toOffset($node->getFileContents());
if ($node !== null && $offset > $node->getEndPosition() &&
$node->parent->getLastChild() instanceof PhpParser\MissingToken
if (
$node !== null
&& $offset > $node->getEndPosition()
&& $node->parent !== null
&& $node->parent->getLastChild() instanceof PhpParser\MissingToken
) {
$node = $node->parent;
}