diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-01-06 16:17:59 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-01-06 16:17:59 +0200 |
| commit | 547593d3159d8772392e81b40082928094b35b8c (patch) | |
| tree | c8c7a93309c1938d6de8b1fc3ccb8042d2210821 /internal/client/ui/core/chat | |
| parent | 6be63e6df626e390565e26439b65e81088375a84 (diff) | |
Fleshed out and fixed issues in both the server and client for how
networks and members work
Diffstat (limited to 'internal/client/ui/core/chat')
| -rw-r--r-- | internal/client/ui/core/chat/chat.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/client/ui/core/chat/chat.go b/internal/client/ui/core/chat/chat.go index c94db31..11cb751 100644 --- a/internal/client/ui/core/chat/chat.go +++ b/internal/client/ui/core/chat/chat.go @@ -255,8 +255,10 @@ func (m *Model) SetFrequency(networkIndex, frequencyIndex int) tea.Cmd { } func (m *Model) ResetBeforeSwitch() { - if m.frequencyIndex != -1 && m.networkIndex != -1 { - network := state.State.Networks[m.networkIndex] + networks := state.State.Networks + networkInBounds := 0 <= m.networkIndex && m.networkIndex < len(networks) + if m.frequencyIndex != -1 && networkInBounds { + network := networks[m.networkIndex] frequencyId := network.Frequencies[m.frequencyIndex].ID log.Println("Saving", frequencyId) state.State.FrequencyState[frequencyId] = state.Frequency{ |
