Skip to content

Commit

Permalink
WorkbookEditorsHandler: Fix NPE in case name is null
Browse files Browse the repository at this point in the history
Regression was introduced in 03277d3,
where getTitle() was accidentally changed to getName().

Revert that back to getTitle().

getTitle() is already null-safe in most cases, but to be 100% safe,
guard it using Util.safeString() again.

Fixes #1275.
  • Loading branch information
sratz authored and iloveeclipse committed Nov 14, 2023
1 parent 4c5fccc commit 3002012
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.dialogs.SearchPattern;
import org.eclipse.ui.dialogs.StyledStringHighlighter;
import org.eclipse.ui.internal.util.Util;
import org.eclipse.ui.themes.ITheme;

/**
Expand Down Expand Up @@ -163,7 +164,7 @@ private List<EditorReference> getParts(WorkbenchPage page) {
private Map<EditorReference, String> generateColumnLabelTexts(List<EditorReference> editorReferences) {
Map<EditorReference, String> editorReferenceLabelTexts = new HashMap<>(editorReferences.size());
Map<String, List<EditorReference>> collisionsMap = editorReferences.stream()
.collect(Collectors.groupingBy(r -> r.getName()));
.collect(Collectors.groupingBy(r -> Util.safeString(r.getTitle())));

for (Entry<String, List<EditorReference>> groupedEditorReferences : collisionsMap.entrySet()) {
if (groupedEditorReferences.getValue().size() == 1) {
Expand Down

0 comments on commit 3002012

Please sign in to comment.