From 598f24dd4edab5b1b5afaf7742c6a55cb05f8f9e Mon Sep 17 00:00:00 2001 From: Arvid Bjurklint Date: Fri, 16 Aug 2024 13:45:53 +0200 Subject: [PATCH] Return immediately on changing mounts if there are less than 2 --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 5b011be..874e836 100644 --- a/main.go +++ b/main.go @@ -366,6 +366,9 @@ func (u *Ui) moveDown() { } func (u *Ui) nextMount() { + if len(u.Mounts) < 2 { + return + } if u.CurrentMount == 0 { u.CurrentMount = len(u.Mounts) - 1 } else { @@ -379,6 +382,9 @@ func (u *Ui) nextMount() { } func (u *Ui) previousMount() { + if len(u.Mounts) < 2 { + return + } u.CurrentMount = (u.CurrentMount + 1) % len(u.Mounts) drawLoadingScreen(*u) u.Screen.Show()