From 757c3c12d745cfbe476f4cb1607d3dad9b7cba36 Mon Sep 17 00:00:00 2001 From: Andreas Buchen Date: Mon, 23 Sep 2024 20:19:03 +0200 Subject: [PATCH] Fixed NPE when sorting the all time high column Issue: #4225 --- .../ui/views/columns/DistanceFromAllTimeHighColumn.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/columns/DistanceFromAllTimeHighColumn.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/columns/DistanceFromAllTimeHighColumn.java index 11aea5fef4..f01413d1e8 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/columns/DistanceFromAllTimeHighColumn.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/columns/DistanceFromAllTimeHighColumn.java @@ -76,8 +76,10 @@ public DistanceFromAllTimeHighColumn(Supplier dateProvider, List { ReportingPeriod option = (ReportingPeriod) ColumnViewerSorter.SortingContext.getColumnOption(); - Double v1 = valueProvider.apply(o1, option).getDistance(); - Double v2 = valueProvider.apply(o2, option).getDistance(); + var ath1 = valueProvider.apply(o1, option); + Double v1 = ath1 == null ? null : ath1.getDistance(); + var ath2 = valueProvider.apply(o2, option); + Double v2 = ath2 == null ? null : ath2.getDistance(); if (v1 == null && v2 == null) return 0;