diff --git a/core/src/main/java/haveno/core/api/CoreOffersService.java b/core/src/main/java/haveno/core/api/CoreOffersService.java index 3f0c8cf7cd..bdc02911ef 100644 --- a/core/src/main/java/haveno/core/api/CoreOffersService.java +++ b/core/src/main/java/haveno/core/api/CoreOffersService.java @@ -72,7 +72,6 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; import java.util.Comparator; -import static java.util.Comparator.comparing; import java.util.List; import java.util.Optional; import java.util.function.Consumer; @@ -87,9 +86,21 @@ public class CoreOffersService { private static final long WAIT_FOR_EDIT_REMOVAL_MS = 5000; - private final Supplier> priceComparator = () -> comparing(Offer::getPrice); - private final Supplier> openOfferPriceComparator = () -> comparing(openOffer -> openOffer.getOffer().getPrice()); - private final Supplier> reversePriceComparator = () -> comparing(Offer::getPrice).reversed(); + private final Supplier> priceComparator = + () -> Comparator.comparing( + Offer::getPrice, + Comparator.nullsLast(Comparator.naturalOrder()) + ); + private final Supplier> openOfferPriceComparator = + () -> Comparator.comparing( + openOffer -> openOffer.getOffer().getPrice(), + Comparator.nullsLast(Comparator.naturalOrder()) + ); + private final Supplier> reversePriceComparator = + () -> Comparator.comparing( + Offer::getPrice, + Comparator.nullsLast(Comparator.naturalOrder()) + ).reversed(); private final CoreContext coreContext; private final KeyRing keyRing;