fix nullpointer
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.sasiedzi.event.domain;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Objects;
|
||||
|
||||
public class TransactionItemComparator implements Comparator<TransactionItem> {
|
||||
|
||||
@@ -11,7 +12,7 @@ public class TransactionItemComparator implements Comparator<TransactionItem> {
|
||||
if (item1 == null && item2 == null) return 0;
|
||||
if (item1 == null) return -1;
|
||||
if (item2 == null) return 1;
|
||||
if (item1.getId().equals(item2.getId())) return 0;
|
||||
if (Objects.equals(item1.getId(), item2.getId())) return 0;
|
||||
|
||||
// Teraz porównujemy pola userAccount
|
||||
return compareUserAccounts(item1.getUserAccount(), item2.getUserAccount());
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.sasiedzi.event.service.Account;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Objects;
|
||||
|
||||
public class UserAccountComparator implements Comparator<UserAccount> {
|
||||
|
||||
@@ -22,7 +23,7 @@ public class UserAccountComparator implements Comparator<UserAccount> {
|
||||
if (ua1 == null && ua2 == null) return 0;
|
||||
if (ua1 == null) return -1;
|
||||
if (ua2 == null) return 1;
|
||||
if (ua1.getId().equals(ua2.getId())) return 0;
|
||||
if (Objects.equals(ua1.getId(), ua2.getId())) return 0;
|
||||
|
||||
String name1 = ua1.getName();
|
||||
String name2 = ua2.getName();
|
||||
|
||||
Reference in New Issue
Block a user