From 9a3598ee00f231850053cefd533b2d01f4e9f486 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Fri, 16 Mar 2007 14:58:57 +0000 Subject: [PATCH] Avoid possible NPE --- .../ui/editor/SemanticHighlightingReconciler.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java index 6a6224badcd..b70432670c3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java @@ -161,9 +161,11 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener { if (useLocation != null) { IASTPreprocessorMacroDefinition macroDef= ((IASTMacroExpansion)nodeLocations[0]).getMacroDefinition(); IASTNodeLocation defLocation= macroDef.getName().getFileLocation(); - IASTNode macroNode= node.getTranslationUnit().selectNodeForLocation(fFilePath, useLocation.getNodeOffset(), defLocation.getNodeLength()); - if (macroNode != null && visitMacro(macroNode, defLocation.getNodeLength())) { - return true; + if (defLocation != null) { + IASTNode macroNode= node.getTranslationUnit().selectNodeForLocation(fFilePath, useLocation.getNodeOffset(), defLocation.getNodeLength()); + if (macroNode != null && visitMacro(macroNode, defLocation.getNodeLength())) { + return true; + } } } }