From a92a8fb1a1ea61783a6a9563aa9f6c0967c76089 Mon Sep 17 00:00:00 2001 From: Fritz Schrogl Date: Sun, 18 Feb 2018 16:21:33 +0100 Subject: Null-safe compare for ticket milestones without due date --- src/main/java/com/gitblit/wicket/pages/TicketsPage.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/com/gitblit/wicket/pages/TicketsPage.java b/src/main/java/com/gitblit/wicket/pages/TicketsPage.java index ecfed250..ebf4dc52 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketsPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketsPage.java @@ -521,14 +521,26 @@ public class TicketsPage extends RepositoryPage { Collections.sort(openMilestones, new Comparator() { @Override public int compare(TicketMilestone o1, TicketMilestone o2) { - return o2.due.compareTo(o1.due); + if (o1.due == null) { + return (o2.due == null) ? 0 : 1; + } else if (o2.due == null) { + return -1; + } else { + return o1.due.compareTo(o2.due); + } } }); Collections.sort(closedMilestones, new Comparator() { @Override public int compare(TicketMilestone o1, TicketMilestone o2) { - return o2.due.compareTo(o1.due); + if (o1.due == null) { + return (o2.due == null) ? 0 : 1; + } else if (o2.due == null) { + return -1; + } else { + return o1.due.compareTo(o2.due); + } } }); -- cgit v1.2.3