1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-16 21:45:22 +02:00

Fox for 138886 - If indexerId is for an unknown indexer, default to the Null indexer instead of causing an NPE.

This commit is contained in:
Doug Schaefer 2006-05-11 13:30:11 +00:00
parent 33160cd843
commit cff21a926b

View file

@ -22,6 +22,7 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICElementDelta;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IElementChangedListener;
import org.eclipse.cdt.internal.core.pdom.indexer.nulli.PDOMNullIndexer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
@ -219,14 +220,16 @@ public class PDOMManager implements IPDOMManager, IElementChangedListener {
// Look up in extension point
IExtension indexerExt = Platform.getExtensionRegistry()
.getExtension(CCorePlugin.INDEXER_UNIQ_ID, indexerId);
IConfigurationElement[] elements = indexerExt.getConfigurationElements();
for (int i = 0; i < elements.length; ++i) {
IConfigurationElement element = elements[i];
if ("run".equals(element.getName())) //$NON-NLS-1$
return (IPDOMIndexer)element.createExecutableExtension("class"); //$NON-NLS-1$
if (indexerExt != null) {
IConfigurationElement[] elements = indexerExt.getConfigurationElements();
for (int i = 0; i < elements.length; ++i) {
IConfigurationElement element = elements[i];
if ("run".equals(element.getName())) //$NON-NLS-1$
return (IPDOMIndexer)element.createExecutableExtension("class"); //$NON-NLS-1$
}
}
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID,
0, CCorePlugin.getResourceString("indexer.notFound"), null)); //$NON-NLS-1$
// Unknown index, default to the null one
return new PDOMNullIndexer();
}
public ISchedulingRule getIndexerSchedulingRule() {