Skip to content

Commit ceb2335

Browse files
jonahgrahamiloveeclipse
authored andcommitted
Resolve NPE when Ids don't have associated configuration elements
This fixes a regression introduced in 34b8e38 When that commit was done some instanceof checks were removed. The result of removing the instanceof checks had the side effect of removing the implicit null check that instanceof essentially does. This change restores the null check for when IConfigurationElement is null. Fixes #1608
1 parent e8a1e17 commit ceb2335

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/rows/IdAttributeRow.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,28 @@ public String getText(Object element) {
5353
Entry<String, IConfigurationElement> entry = (Entry<String, IConfigurationElement>) element;
5454
String text = entry.getKey();
5555
IConfigurationElement value = entry.getValue();
56-
String name = value.getAttribute("name"); //$NON-NLS-1$
57-
if (name == null) {
58-
name = value.getAttribute("label"); //$NON-NLS-1$
56+
if (value != null) {
57+
String name = value.getAttribute("name"); //$NON-NLS-1$
5958
if (name == null) {
60-
name = value.getAttribute("description"); //$NON-NLS-1$
59+
name = value.getAttribute("label"); //$NON-NLS-1$
60+
if (name == null) {
61+
name = value.getAttribute("description"); //$NON-NLS-1$
62+
}
6163
}
62-
}
6364

64-
String contributor = value.getContributor().getName();
65+
String contributor = value.getContributor().getName();
6566

66-
if (input != null && name != null && name.startsWith("%") && contributor != null) { //$NON-NLS-1$
67-
IPluginModelBase model = PluginRegistry.findModel(contributor);
68-
name = model.getResourceString(name);
69-
}
67+
if (input != null && name != null && name.startsWith("%") && contributor != null) { //$NON-NLS-1$
68+
IPluginModelBase model = PluginRegistry.findModel(contributor);
69+
name = model.getResourceString(name);
70+
}
7071

71-
if (name != null) {
72-
text += " - " + name; //$NON-NLS-1$
73-
}
74-
if (contributor != null) {
75-
text += " [" + contributor + "]"; //$NON-NLS-1$ //$NON-NLS-2$
72+
if (name != null) {
73+
text += " - " + name; //$NON-NLS-1$
74+
}
75+
if (contributor != null) {
76+
text += " [" + contributor + "]"; //$NON-NLS-1$ //$NON-NLS-2$
77+
}
7678
}
7779
return text;
7880
}

0 commit comments

Comments
 (0)