1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for 159863 by Wieant, NPE in full indexer.

This commit is contained in:
Markus Schorn 2006-10-05 12:56:12 +00:00
parent fd2c99b278
commit 2b21a7091f

View file

@ -17,6 +17,7 @@ import org.eclipse.cdt.core.model.ICElementVisitor;
import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
@ -74,14 +75,17 @@ public class PDOMFullReindex extends PDOMFullIndexerJob {
ITranslationUnit tu = (ITranslationUnit)element; ITranslationUnit tu = (ITranslationUnit)element;
if (tu.isHeaderUnit()) { if (tu.isHeaderUnit()) {
IFile rfile = (IFile)tu.getUnderlyingResource(); IFile rfile = (IFile)tu.getUnderlyingResource();
String filename = rfile.getLocation().toOSString(); IPath fileLocation = rfile.getLocation();
if (pdom.getFile(filename) == null) { if ( fileLocation != null ) {
try { String filename = fileLocation.toOSString();
addTU(tu); if (pdom.getFile(filename) == null) {
} catch (InterruptedException e) { try {
CCorePlugin.log(e); addTU(tu);
if (++errorCount > MAX_ERRORS) } catch (InterruptedException e) {
throw new CoreException(Status.CANCEL_STATUS); CCorePlugin.log(e);
if (++errorCount > MAX_ERRORS)
throw new CoreException(Status.CANCEL_STATUS);
}
} }
} }
} }