return empty table when no db result

This commit is contained in:
Senghan Bright 2021-01-14 14:15:42 +01:00
parent ecbd05144c
commit 8facdb9c2e

View File

@ -60,10 +60,12 @@ end
local function get_file_scores() local function get_file_scores()
if not sql_wrapper then return end if not sql_wrapper then return end
local scores = {}
local files = sql_wrapper:do_transaction('get_all_filepaths') local files = sql_wrapper:do_transaction('get_all_filepaths')
local timestamp_ages = sql_wrapper:do_transaction('get_all_timestamp_ages') local timestamp_ages = sql_wrapper:do_transaction('get_all_timestamp_ages')
local scores = {} if vim.tbl_isempty(files) then return scores end
for _, file_entry in ipairs(files) do for _, file_entry in ipairs(files) do
table.insert(scores, { table.insert(scores, {
filename = file_entry.path, filename = file_entry.path,