diff options
author | Fritz Schrogl <fs+github@schrogl.at> | 2018-02-18 16:21:33 +0100 |
---|---|---|
committer | Florian Zschocke <fzs@users.noreply.github.com> | 2019-06-10 17:52:38 +0200 |
commit | a92a8fb1a1ea61783a6a9563aa9f6c0967c76089 (patch) | |
tree | 99e9bf922c5469de4d57670b8d2aec4172bb8d8b /src | |
parent | d52dfc25d592b3e88ace4bcd30aff1fb665b88e5 (diff) | |
download | gitblit-a92a8fb1a1ea61783a6a9563aa9f6c0967c76089.tar.gz gitblit-a92a8fb1a1ea61783a6a9563aa9f6c0967c76089.zip |
Null-safe compare for ticket milestones without due date
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/TicketsPage.java | 16 |
1 files changed, 14 insertions, 2 deletions
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<TicketMilestone>() {
@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<TicketMilestone>() {
@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);
+ }
}
});
|