1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

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 <malaperle@gmail.com>
This commit is contained in:
Marc-Andre Laperle 2020-09-25 00:47:48 -04:00 committed by Marc-André Laperle
parent f2761aa76c
commit 2015e9b009

View file

@ -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