From 901424593a4322d5c258266fa6ed9d4bc1db0333 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 3 Mar 2013 16:12:33 -0800 Subject: [PATCH] Ticket #269: Fix NPE in connection record re: dates. --- .../guacamole/net/auth/mysql/MySQLConnectionRecord.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionRecord.java b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionRecord.java index 40655373d..bee0917a0 100644 --- a/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionRecord.java +++ b/extensions/guacamole-auth-mysql/src/main/java/net/sourceforge/guacamole/net/auth/mysql/MySQLConnectionRecord.java @@ -72,18 +72,20 @@ public class MySQLConnectionRecord implements ConnectionRecord { */ public MySQLConnectionRecord(Date startDate, Date endDate, String username) { - this.startDate = new Date(startDate.getTime()); - this.endDate = new Date(endDate.getTime()); + if (startDate != null) this.startDate = new Date(startDate.getTime()); + if (endDate != null) this.endDate = new Date(endDate.getTime()); this.username = username; } @Override public Date getStartDate() { + if (startDate == null) return null; return new Date(startDate.getTime()); } @Override public Date getEndDate() { + if (endDate == null) return null; return new Date(endDate.getTime()); }