From afbb26d1e8f8d75c44c4e429654102380a21f587 Mon Sep 17 00:00:00 2001 From: Senghan Bright Date: Sat, 16 Jan 2021 01:11:22 +0100 Subject: [PATCH] fix incorrect empty result from filepath_row_id() --- lua/telescope/_extensions/frecency/sql_wrapper.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lua/telescope/_extensions/frecency/sql_wrapper.lua b/lua/telescope/_extensions/frecency/sql_wrapper.lua index 763c4c6..c3d927f 100644 --- a/lua/telescope/_extensions/frecency/sql_wrapper.lua +++ b/lua/telescope/_extensions/frecency/sql_wrapper.lua @@ -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)