From 0ebf4b798807cdff13ce64272671009a4e1ea4fe Mon Sep 17 00:00:00 2001 From: Matt Bernhard Date: Thu, 5 Dec 2024 14:08:49 -0500 Subject: [PATCH] Handling null clock case --- .../us/freeandfair/corla/model/Administrator.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server/eclipse-project/src/main/java/us/freeandfair/corla/model/Administrator.java b/server/eclipse-project/src/main/java/us/freeandfair/corla/model/Administrator.java index 2f54b9e3..3129b458 100644 --- a/server/eclipse-project/src/main/java/us/freeandfair/corla/model/Administrator.java +++ b/server/eclipse-project/src/main/java/us/freeandfair/corla/model/Administrator.java @@ -208,7 +208,11 @@ public Instant lastLoginTime() { * Updates the last login time to the current time. */ public void updateLastLoginTime() { - my_last_login_time = Instant.now(my_clock); + if (my_clock == null) { + my_last_login_time = Instant.now(); + } else { + my_last_login_time = Instant.now(my_clock); + } } /** @@ -222,7 +226,11 @@ public Instant lastLogoutTime() { * Updates the last logout time to the current time. */ public void updateLastLogoutTime() { - my_last_logout_time = Instant.now(my_clock); + if (my_clock == null) { + my_last_login_time = Instant.now(); + } else { + my_last_login_time = Instant.now(my_clock); + } } /**