mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-19 05:44:05 +01:00
Fix NPE from BurningManView column comparators
Make sure that none of the key extractor functions passed to 'Comparator.comparing(fn)' can return null, as this results in an NPE when the corresponding column is sorted in the UI, but has blank entries (such as the BTC received for a BSQ burn in the balance entries table). (Make blanks appear smallest in magnitude using 'Comparator.nullsFirst' or by defaulting to 0 instead of null, since the entries are initially sorted biggest to smallest, pushing them to the bottom of the table.) Also change the default sort type of the burned BSQ column, which should be ASCENDING since the entries are negative.
This commit is contained in:
parent
23dae954e7
commit
8e8d727231
@ -1380,7 +1380,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
balanceEntryTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(e -> e.getReceivedBtc().orElse(null)));
|
||||
column.setComparator(Comparator.comparing(e -> e.getReceivedBtc().orElse(0L)));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.balanceEntry.price"));
|
||||
@ -1404,7 +1404,8 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
balanceEntryTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(e -> e.getPrice().orElse(null)));
|
||||
column.setComparator(Comparator.comparing(e -> e.getPrice().orElse(null),
|
||||
Comparator.nullsFirst(Comparator.naturalOrder())));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.balanceEntry.receivedBtcAsBsq"));
|
||||
@ -1428,7 +1429,7 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
balanceEntryTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(e -> e.getReceivedBtcAsBsq().orElse(null)));
|
||||
column.setComparator(Comparator.comparing(e -> e.getReceivedBtcAsBsq().orElse(0L)));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.balanceEntry.burnedBsq"));
|
||||
@ -1452,8 +1453,8 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
balanceEntryTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(e -> e.getBurnedBsq().orElse(null)));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
column.setComparator(Comparator.comparing(e -> e.getBurnedBsq().orElse(0L)));
|
||||
column.setSortType(TableColumn.SortType.ASCENDING);
|
||||
|
||||
|
||||
column = new AutoTooltipTableColumn<>(Res.get("dao.burningman.table.balanceEntry.revenue"));
|
||||
@ -1501,7 +1502,8 @@ public class BurningManView extends ActivatableView<ScrollPane, Void> implements
|
||||
}
|
||||
});
|
||||
balanceEntryTableView.getColumns().add(column);
|
||||
column.setComparator(Comparator.comparing(e -> e.getType().orElse(null)));
|
||||
column.setComparator(Comparator.comparing(e -> e.getType().orElse(null),
|
||||
Comparator.nullsFirst(Comparator.naturalOrder())));
|
||||
column.setSortType(TableColumn.SortType.DESCENDING);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user