fix incorrect empty result from filepath_row_id()

This commit is contained in:
Senghan Bright 2021-01-16 01:11:22 +01:00
parent a12e98f7c7
commit afbb26d1e8

View File

@ -89,9 +89,8 @@ end
function M:get_filepath_row_id(filepath)
local res
local func = function(db) res = db:select("files", { where = { path = filepath}}) end
self.db:with_open(func)
return res and res[1].id or nil
self.db:with_open(function(db) res = db:select("files", { where = { path = filepath}}) end)
return not vim.tbl_isempty(res) and res[1].id or nil
end
function M:update(filepath)