From 555db6afca2dd46e292b3e84a35187346ffc54d7 Mon Sep 17 00:00:00 2001 From: Corey Arthur Date: Mon, 27 Apr 2020 12:45:33 +0100 Subject: [PATCH] Fix invalid sort key preventing load --- .../nccgroup/loggerplusplus/logview/logtable/LogTable.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/nccgroup/loggerplusplus/logview/logtable/LogTable.java b/src/main/java/com/nccgroup/loggerplusplus/logview/logtable/LogTable.java index 5c28ccef..f43b38af 100644 --- a/src/main/java/com/nccgroup/loggerplusplus/logview/logtable/LogTable.java +++ b/src/main/java/com/nccgroup/loggerplusplus/logview/logtable/LogTable.java @@ -68,7 +68,11 @@ public class LogTable extends JTable Integer sortColumn = this.preferences.getSetting(Globals.PREF_SORT_COLUMN); SortOrder sortOrder = this.preferences.getSetting(Globals.PREF_SORT_ORDER); if(sortColumn >= 0 && sortOrder != SortOrder.UNSORTED){ - this.sorter.setSortKeys(Collections.singletonList(new RowSorter.SortKey(sortColumn, sortOrder))); + try { + this.sorter.setSortKeys(Collections.singletonList(new RowSorter.SortKey(sortColumn, sortOrder))); + }catch (IllegalArgumentException exception){ + //If we can't set the sort key because its invalid, just ignore it. + } } this.getSelectionModel().addListSelectionListener(e -> {