]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/util/DayDate.java
fix: Implement both a null-pointer check and a hashCode function
[gigi.git] / 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);
     }