From 2adb6f5d2be3cdcd2ab747262276d6b09cc5ef96 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Thu, 18 Dec 2008 09:43:13 +0000 Subject: [PATCH] NPE in heuristics for include file resolution, bug 259222. --- .../indexer/ProjectIndexerIncludeResolutionHeuristics.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerIncludeResolutionHeuristics.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerIncludeResolutionHeuristics.java index 33a0675a382..019ca8dbc92 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerIncludeResolutionHeuristics.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/indexer/ProjectIndexerIncludeResolutionHeuristics.java @@ -24,6 +24,7 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; /** @@ -71,7 +72,11 @@ public class ProjectIndexerIncludeResolutionHeuristics implements IIncludeFileRe if (files.length == 0) return null; - return selectBest(files, ifl.getFullPath().toCharArray()).getLocation().toString(); + final IPath bestLocation = selectBest(files, ifl.getFullPath().toCharArray()).getLocation(); + if (bestLocation == null) + return null; + + return bestLocation.toString(); }