From 497e768f9871f994be2f28494e102837c37687e2 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Tue, 1 Feb 2005 16:49:20 +0000 Subject: [PATCH] Partial fix for Bug 84146 - there are dirty ASTNodes floating around with "null declarators" --- .../org/eclipse/cdt/internal/core/dom/parser/ASTNode.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java index fb6b9ffb904..35340928ce6 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTNode.java @@ -19,6 +19,7 @@ public abstract class ASTNode implements IASTNode { private int length; private int offset; + private static final IASTNodeLocation[] EMPTY_LOCATION_ARRAY = new IASTNodeLocation[0]; public int getOffset() { return offset; @@ -52,6 +53,7 @@ public abstract class ASTNode implements IASTNode { * @see org.eclipse.cdt.core.dom.ast.IASTNode#getNodeLocations() */ public IASTNodeLocation[] getNodeLocations() { + if( length == 0 ) return EMPTY_LOCATION_ARRAY; return getTranslationUnit().getLocationInfo( offset, length ); }