mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 22:22:11 +02:00
Bug 553761 - NPE at GNUCSourceParser.identifier
- add null node check in GNUSourceParser.identifier() - same for GNUCPPSourceParser.buildName() Change-Id: Ic170d0220d179947af5b9c0d7dc50f1ed9e5965d
This commit is contained in:
parent
9d897fcc04
commit
45585fcbbf
2 changed files with 9 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2015 IBM Corporation and others.
|
||||
* Copyright (c) 2005, 2019 IBM Corporation and others.
|
||||
*
|
||||
* This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License 2.0
|
||||
|
@ -24,6 +24,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTAlignmentSpecifier;
|
||||
|
@ -1748,7 +1749,9 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
consume();
|
||||
n = getNodeFactory().newName(t.getCharImage());
|
||||
setRange(n, t.getOffset(), t.getEndOffset());
|
||||
createCompletionNode(t).addName(n);
|
||||
ASTCompletionNode node = createCompletionNode(t);
|
||||
if (node != null)
|
||||
node.addName(n);
|
||||
return n;
|
||||
|
||||
default:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2016 IBM Corporation and others.
|
||||
* Copyright (c) 2002, 2019 IBM Corporation and others.
|
||||
*
|
||||
* This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License 2.0
|
||||
|
@ -462,7 +462,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
switch (nt.getType()) {
|
||||
case IToken.tEOC:
|
||||
case IToken.tCOMPLETION:
|
||||
createCompletionNode(nt).addName(name);
|
||||
ASTCompletionNode node = createCompletionNode(nt);
|
||||
if (node != null)
|
||||
node.addName(name);
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
|
|
Loading…
Add table
Reference in a new issue