]> WPIA git - gigi.git/commitdiff
fix: Implement both a null-pointer check and a hashCode function
authorBenny Baumann <BenBE1987@gmx.net>
Sun, 7 Aug 2016 00:45:20 +0000 (02:45 +0200)
committerBenny Baumann <BenBE1987@gmx.net>
Sun, 7 Aug 2016 11:49:52 +0000 (13:49 +0200)
Change-Id: If22bdba6fc796223f63cc0a3684ae49d51c96a13

src/org/cacert/gigi/util/DayDate.java

index 0b7ba383a7c9e30fbe73e8528090fc8cc84ee966..a38e318c98f183cd85e9399c0ee6ee5fe24b53f7 100644 (file)
@@ -58,12 +58,20 @@ public class DayDate {
 
     @Override
     public boolean equals(Object obj) {
+        if (null == obj) {
+            return false;
+        }
         if ( !(obj instanceof DayDate)) {
             throw new Error("You may not compare this date somthing other than a DayDate");
         }
         return ((DayDate) obj).time == time;
     }
 
+    @Override
+    public int hashCode() {
+        return Long.hashCode(time);
+    }
+
     public java.util.Date toDate() {
         return new java.util.Date(time);
     }