From 31a57e9a7dd91b8decf7f6b4018fa3ae1f896682 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Sun, 24 Jan 2016 22:33:32 +0000 Subject: Fix nil reference in session lib when no lock events --- lib/session.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/session.lua b/lib/session.lua index b4965ee..cc2e0d7 100644 --- a/lib/session.lua +++ b/lib/session.lua @@ -199,7 +199,7 @@ mymodule.list_events = function (sessionpath, id_user, ipaddr, minutes) local t = posix.glob(searchfor) local ipaddrhash = mymodule.hash_ip_addr(ipaddr) - for a,b in pairs(t) do + for a,b in pairs(t or {}) do if posix.stat(b,"mtime") > minutes_ago then local user, ip, time, pid = string.match(b, "/lockevent%.([^.]*)%.([^.]*)%.([^.]*)%.([^.]*)$") if user and (not id_user or id_user == user) and (not ipaddr or ipaddrhash == ip) then @@ -258,7 +258,7 @@ mymodule.delete_events = function (sessionpath, id_user, ipaddr) local t = posix.glob(searchfor) local ipaddrhash = mymodule.hash_ip_addr(ipaddr) - for a,b in pairs(t) do + for a,b in pairs(t or {}) do local user, ip = string.match(b, "/lockevent%.([^.]*)%.([^.]*)%.") if user and (not id_user or id_user == user) and (not ipaddr or ipaddrhash == ip) then os.remove(b) -- cgit v1.2.3