summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/dirlist.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index 5cdbe06..9267a3c 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -277,11 +277,17 @@ func (dirlist *DirectoryList) NextPrev(delta int) {
 	}
 	newIdx := curIdx + delta
 	ndirs := len(dirlist.dirs)
+
+	if ndirs == 0 {
+		return
+	}
+
 	if newIdx < 0 {
 		newIdx = ndirs - 1
 	} else if newIdx >= ndirs {
 		newIdx = 0
 	}
+
 	dirlist.Select(dirlist.dirs[newIdx])
 }