Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2015-01-23 19:20:21 +0000
committerAlena Laskavaia2015-01-26 18:09:47 +0000
commitf0f371b10d0c6ca004d9cf98e3e3e64229f74d51 (patch)
treed679d6a686ade85d0b15ee4e028bfa47f131fd39
parentb44dbb9ea584c8be6894ee3d2e63a31bd5c5678b (diff)
downloadorg.eclipse.cdt-f0f371b10d0c6ca004d9cf98e3e3e64229f74d51.tar.gz
org.eclipse.cdt-f0f371b10d0c6ca004d9cf98e3e3e64229f74d51.tar.xz
org.eclipse.cdt-f0f371b10d0c6ca004d9cf98e3e3e64229f74d51.zip
Fixed NPE when opening preference page for Working Sets
java.lang.NullPointerException at org.eclipse.cdt.internal.ui.workingsets.IWorkingSetProjectConfigurationFactory$Registry$1.compare(IWorkingSetProjectConfigurationFactory.java:180) at org.eclipse.cdt.internal.ui.workingsets.IWorkingSetProjectConfigurationFactory$Registry$1.compare(IWorkingSetProjectConfigurationFactory.java:1) at java.util.TimSort.countRunAndMakeAscending(TimSort.java:352) at java.util.TimSort.sort(TimSort.java:216) at java.util.Arrays.sort(Arrays.java:1438) Change-Id: Ibe91a679c876ed5f70f4f787188e13e52203466c Signed-off-by: Alena Laskavaia <elaskavaia.cdt@gmail.com>
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/IWorkingSetProjectConfigurationFactory.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/IWorkingSetProjectConfigurationFactory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/IWorkingSetProjectConfigurationFactory.java
index 5edef550059..0fe3241f0b0 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/IWorkingSetProjectConfigurationFactory.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/workingsets/IWorkingSetProjectConfigurationFactory.java
@@ -170,16 +170,23 @@ public interface IWorkingSetProjectConfigurationFactory {
result = new String[0];
}
+ for (String natureId : result) {
+ if (projectNaturePartOrdering.get(natureId) == null) {
+ // re-do nature cache. Some natures were added recently
+ projectNaturePartOrdering = computeProjectNaturePartOrdering();
+ break;
+ }
+ }
+
if (result.length > 0) {
Arrays.sort(result, new Comparator<String>() {
@Override
public int compare(String nature1, String nature2) {
Set<String> required1 = projectNaturePartOrdering.get(nature1);
Set<String> required2 = projectNaturePartOrdering.get(nature2);
-
- if (required1.contains(nature2)) {
+ if (required1 != null && required1.contains(nature2)) {
return -1; // required1 precedes required2
- } else if (required2.contains(nature1)) {
+ } else if (required2 != null && required2.contains(nature1)) {
return +1; // required2 precedes required1
} else if (nature1.startsWith("org.eclipse.cdt.") //$NON-NLS-1$
&& !nature2.startsWith("org.eclipse.cdt.")) { //$NON-NLS-1$

Back to the top