aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuldoman <giulio.lettieri@gmail.com>2021-08-29 04:02:53 +0200
committerFrancesco <francesco.bbt@gmail.com>2021-08-29 11:13:39 +0200
commitab6eac399c7b38680a99c911f4d41478dc711ac2 (patch)
treeb513de059b61ee6e1c72ae98f0e4e5eeff8a7817
parent76334a7946e2f936daf99dafff2be59f149018b3 (diff)
downloadlite-xl-ab6eac399c7b38680a99c911f4d41478dc711ac2.tar.gz
lite-xl-ab6eac399c7b38680a99c911f4d41478dc711ac2.zip
Fix crash in project search when project has no files
-rw-r--r--data/plugins/projectsearch.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/data/plugins/projectsearch.lua b/data/plugins/projectsearch.lua
index 45967697..dda3a2d0 100644
--- a/data/plugins/projectsearch.lua
+++ b/data/plugins/projectsearch.lua
@@ -171,7 +171,7 @@ function ResultsView:draw()
local ox, oy = self:get_content_offset()
local x, y = ox + style.padding.x, oy + style.padding.y
local files_number = core.project_files_number()
- local per = files_number and self.last_file_idx / files_number or 1
+ local per = common.clamp(files_number and self.last_file_idx / files_number or 1, 0, 1)
local text
if self.searching then
if files_number then