Changeset

1493:d5e8758d391d

mod_lastlog: Fix traceback if no session included with event (eg from mod_register_web) (thanks biszkopcik)
author Kim Alvefur <zash@zash.se>
date Mon, 25 Aug 2014 00:38:14 +0200
parents 1492:8c4a2d85e8bf
children 1494:02cd4a081db4
files mod_lastlog/mod_lastlog.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_lastlog/mod_lastlog.lua	Thu Aug 21 23:14:55 2014 +0200
+++ b/mod_lastlog/mod_lastlog.lua	Mon Aug 25 00:38:14 2014 +0200
@@ -10,7 +10,7 @@
 		datamanager.store(session.username, host, "lastlog", {
 			event = "login";
 			timestamp = time(),
-			ip = log_ip and session.ip or nil,
+			ip = log_ip and session and session.ip or nil,
 		});
 	end
 end);
@@ -21,7 +21,7 @@
 		datamanager.store(session.username, host, "lastlog", {
 			event = "logout";
 			timestamp = time(),
-			ip = log_ip and session.ip or nil,
+			ip = log_ip and session and session.ip or nil,
 		});
 	end
 end);
@@ -31,7 +31,7 @@
 	datamanager.store(event.username, host, "lastlog", {
 		event = "registered";
 		timestamp = time(),
-		ip = log_ip and session.ip or nil,
+		ip = log_ip and session and session.ip or nil,
 	});
 end);