aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/dirtree.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-11-07 22:31:23 +0100
committerRobin Jarry <robin@jarry.cc>2022-11-09 21:42:50 +0100
commit47a0f7d8e88ef47a127f42113e28f053c6ff04b8 (patch)
treeb89a85b6bf3b45e28413a7a450d08efbb25df068 /widgets/dirtree.go
parent650e00972d036014530594bbd781579166889a5e (diff)
downloadaerc-47a0f7d8e88ef47a127f42113e28f053c6ff04b8.tar.gz
dirtree: prevent panic when no folder is found
Prevent crash when no folder is found. Fixes: https://todo.sr.ht/~rjarry/aerc/100 Fixes: https://todo.sr.ht/~rjarry/aerc/101 Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net>
Diffstat (limited to 'widgets/dirtree.go')
-rw-r--r--widgets/dirtree.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/widgets/dirtree.go b/widgets/dirtree.go
index 3e419d47..f475255f 100644
--- a/widgets/dirtree.go
+++ b/widgets/dirtree.go
@@ -59,7 +59,7 @@ func (dt *DirectoryTree) Draw(ctx *ui.Context) {
}
n := dt.countVisible(dt.list)
- if n == 0 {
+ if n == 0 || dt.listIdx < 0 {
style := dt.UiConfig("").GetStyle(config.STYLE_DIRLIST_DEFAULT)
ctx.Printf(0, 0, style, dt.UiConfig("").EmptyDirlist)
return