Fix: crash when creating cache with an empty db

0.4
shivajiva101 2022-04-30 21:25:41 +01:00 committed by GitHub
parent 332a823048
commit 5939b517e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -59,7 +59,7 @@ local function create_cache()
local q = "SELECT max(last_login) AS result FROM auth;"
local it, state = db:nrows(q)
local last = it(state)
if last then
if last and last.result ~= nil then
last = last.result - ttl
q = ([[SELECT * FROM auth WHERE last_login > %s LIMIT %s;
]]):format(last, max_cache_records)