summaryrefslogtreecommitdiff
path: root/internal/client/ui/core
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-01-28 18:28:09 +0200
committerKyren223 <Kyren223@proton.me>2025-01-28 18:28:09 +0200
commit596bbcfe81e2202198415767a06afd9cd1c49d6d (patch)
tree138bf0bb055c707456ee5bdecb8d79b2e64263bb /internal/client/ui/core
parentb9cef4710b1574d7c64b40ba1bcc0013f1c5d337 (diff)
Fixed crash where frequency view will be called after changing the
network due to out of bounds indexing
Diffstat (limited to 'internal/client/ui/core')
-rw-r--r--internal/client/ui/core/frequencylist/frequencylist.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/client/ui/core/frequencylist/frequencylist.go b/internal/client/ui/core/frequencylist/frequencylist.go
index 7c58817..1c7fe22 100644
--- a/internal/client/ui/core/frequencylist/frequencylist.go
+++ b/internal/client/ui/core/frequencylist/frequencylist.go
@@ -302,7 +302,7 @@ func (m *Model) Index() int {
func (m *Model) SetIndex(index int) {
m.index = min(max(index, 0), m.FrequenciesLength()-1)
if m.index < m.base {
- m.base = m.index
+ m.base = max(m.index, 0)
} else if m.index >= m.base+m.height {
m.base = 1 + m.index - m.height
}