diff --git a/source/net/filebot/ui/rename/EpisodeListMatcher.java b/source/net/filebot/ui/rename/EpisodeListMatcher.java index a3d7ae7e..4603b90a 100644 --- a/source/net/filebot/ui/rename/EpisodeListMatcher.java +++ b/source/net/filebot/ui/rename/EpisodeListMatcher.java @@ -238,7 +238,7 @@ class EpisodeListMatcher implements AutoCompleteMatcher { header.setBorder(createCompoundBorder(createTitledBorder(""), createEmptyBorder(3, 3, 3, 3))); // multiple results have been found, user must select one - SelectDialog selectDialog = new SelectDialog(parent, options, true, false, header); + SelectDialog selectDialog = new SelectDialog(parent, options, true, false, header.getText().isEmpty() ? null : header); selectDialog.setTitle(provider.getName()); selectDialog.getMessageLabel().setText("Select best match for \"" + escapeHTML(query) + "\":"); selectDialog.getCancelAction().putValue(Action.NAME, "Skip"); @@ -298,27 +298,29 @@ class EpisodeListMatcher implements AutoCompleteMatcher { protected String getQueryInputMessage(String header, String message, Collection files) throws Exception { List selection = files.stream().sorted(comparing(File::length).reversed()).limit(5).collect(toList()); + if (selection.isEmpty()) { + return ""; + } StringBuilder html = new StringBuilder(512); html.append(""); - if (selection.size() > 0) { - if (header != null) { - html.append(escapeHTML(header)).append("
"); - } - - TextColorizer colorizer = new TextColorizer("• ", "
"); - for (File file : sortByUniquePath(selection)) { - File path = getStructurePathTail(file); - if (path == null) { - path = getRelativePathTail(file, 3); - } - colorizer.colorizePath(html, path, true); - } - if (selection.size() < files.size()) { - html.append("• ").append("…").append("
"); - } - html.append("
"); + if (header != null) { + html.append(escapeHTML(header)).append("
"); } + + TextColorizer colorizer = new TextColorizer("• ", "
"); + for (File file : sortByUniquePath(selection)) { + File path = getStructurePathTail(file); + if (path == null) { + path = getRelativePathTail(file, 3); + } + colorizer.colorizePath(html, path, true); + } + if (selection.size() < files.size()) { + html.append("• ").append("…").append("
"); + } + html.append("
"); + if (message != null) { html.append(escapeHTML(message)); }