From 1bd78220e2138a3ff0dea3609cafe8a3f80da763 Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Wed, 28 Apr 2021 18:50:24 +0300 Subject: [PATCH] avoid crash with dir preview when hidden changes cc #615 --- nav.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nav.go b/nav.go index 885ab6e..5f15182 100644 --- a/nav.go +++ b/nav.go @@ -243,6 +243,10 @@ func (dir *dir) name() string { if len(dir.files) == 0 { return "" } + + dir.ind = max(dir.ind, 0) + dir.ind = min(dir.ind, len(dir.files)-1) + return dir.files[dir.ind].Name() }