From 2015e9b00901b785bce222d58f02f7009f943a1b Mon Sep 17 00:00:00 2001 From: Marc-Andre Laperle Date: Fri, 25 Sep 2020 00:47:48 -0400 Subject: [PATCH] Bug 567334 - Occasional NPE in CompilationDatabaseParser Make sure the project is still accessible before doing the work. It's possible that the project got closed before the job had a chance to start. Change-Id: If02e818394502397e8958d18284160d4f08ca195 Signed-off-by: Marc-Andre Laperle --- .../settings/providers/CompilationDatabaseParser.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java index 36fdfed7181..23a6c3fed8e 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/language/settings/providers/CompilationDatabaseParser.java @@ -398,6 +398,11 @@ public class CompilationDatabaseParser extends LanguageSettingsSerializableProvi // saved that is not stored in the project description (i.e. calls to setProperties) will be saved to the wrong instance so when we call setProjectDescription, our changes will be ignored. // So instead, restart the whole thing with the corresponding CompilationDatabaseParser instance in the writable config. IProject project = cfgDescription.getProjectDescription().getProject(); + if (!project.isAccessible()) { + // Project was probably closed while the job was waiting to start. + return Status.CANCEL_STATUS; + } + ICProjectDescription projectDescription = CCorePlugin.getDefault().getCoreModel() .getProjectDescription(project.getProject(), true); ICConfigurationDescription writableCfg = projectDescription