@@ -264,23 +264,29 @@ private static Set<String> getUnresolvedProjectIncludes(IProject iProject) {
264
264
265
265
public static void checkLibraries (IProject affectedProject ) {
266
266
ICProjectDescriptionManager mngr = CoreModel .getDefault ().getProjectDescriptionManager ();
267
- ICProjectDescription projectDescription = mngr .getProjectDescription (affectedProject , true );
268
- ICConfigurationDescription configurationDescription = projectDescription .getActiveConfiguration ();
269
-
270
- Set <String > UnresolvedIncludedHeaders = getUnresolvedProjectIncludes (affectedProject );
271
- Set <String > alreadyAddedLibs = getAllLibrariesFromProject (affectedProject );
272
- HashMap <String , IPath > availableLibs = getAllInstalledLibraries (configurationDescription );
273
- UnresolvedIncludedHeaders .removeAll (alreadyAddedLibs );
274
- availableLibs .keySet ().retainAll (UnresolvedIncludedHeaders );
275
- if (!availableLibs .isEmpty ()) {
276
- // there are possible libraries to add
277
- Common .log (new Status (IStatus .INFO , Const .CORE_PLUGIN_ID , "list of libraries to add to project " //$NON-NLS-1$
278
- + affectedProject .getName () + ": " + availableLibs .keySet ().toString ())); //$NON-NLS-1$
279
- addLibrariesToProject (affectedProject , configurationDescription , availableLibs );
280
- try {
281
- mngr .setProjectDescription (affectedProject , projectDescription , true , null );
282
- } catch (CoreException e ) {
283
- e .printStackTrace ();
267
+ if (mngr != null ) {
268
+ ICProjectDescription projectDescription = mngr .getProjectDescription (affectedProject , true );
269
+ if (projectDescription != null ) {
270
+ ICConfigurationDescription configurationDescription = projectDescription .getActiveConfiguration ();
271
+ if (configurationDescription != null ) {
272
+
273
+ Set <String > UnresolvedIncludedHeaders = getUnresolvedProjectIncludes (affectedProject );
274
+ Set <String > alreadyAddedLibs = getAllLibrariesFromProject (affectedProject );
275
+ HashMap <String , IPath > availableLibs = getAllInstalledLibraries (configurationDescription );
276
+ UnresolvedIncludedHeaders .removeAll (alreadyAddedLibs );
277
+ availableLibs .keySet ().retainAll (UnresolvedIncludedHeaders );
278
+ if (!availableLibs .isEmpty ()) {
279
+ // there are possible libraries to add
280
+ Common .log (new Status (IStatus .INFO , Const .CORE_PLUGIN_ID , "list of libraries to add to project " //$NON-NLS-1$
281
+ + affectedProject .getName () + ": " + availableLibs .keySet ().toString ())); //$NON-NLS-1$
282
+ addLibrariesToProject (affectedProject , configurationDescription , availableLibs );
283
+ try {
284
+ mngr .setProjectDescription (affectedProject , projectDescription , true , null );
285
+ } catch (CoreException e ) {
286
+ e .printStackTrace ();
287
+ }
288
+ }
289
+ }
284
290
}
285
291
}
286
292
}
0 commit comments