Fixed Nullpointer on recent searches loader

This commit is contained in:
Jindra Petřík
2024-01-13 20:39:54 +01:00
parent e1464270b6
commit 9d0ddb8c6c
2 changed files with 10 additions and 2 deletions

View File

@@ -173,8 +173,15 @@ public class MainFrameRibbonMenu extends MainFrameMenu {
searchHistoryPanel.addButtonGroup(groupName);
Openable openable = Main.getMainFrame().getPanel().getCurrentOpenable();
SWF swf = (openable instanceof SWF) ? (SWF) openable : ((ABC) openable).getSwf();
List<Integer> indices = Main.searchResultsStorage.getIndicesForOpenable(openable);
SWF swf;
if (openable == null) {
swf = null;
} else if (openable instanceof SWF) {
swf = (SWF) openable;
} else {
swf = ((ABC) openable).getSwf();
}
List<Integer> indices = openable == null ? new ArrayList<>() : Main.searchResultsStorage.getIndicesForOpenable(openable);
int height = 0;
height = searchHistoryPanel.getInsets().top + searchHistoryPanel.getInsets().bottom + 6/*groupInset top*/ + new JLabel(groupName).getPreferredSize().height + 4 /*layoutGap*/;