diff options
| author | Kyren223 <Kyren223@proton.me> | 2024-12-21 19:00:37 +0200 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2024-12-21 19:00:37 +0200 |
| commit | e6237f5b1265f43d25963408ab09689e38050a3e (patch) | |
| tree | 8b9071655d5f26cfc8170f2f1f864d6928308cae /internal/client/ui | |
| parent | e88c5f242dbb30f5fc7a9dfb581fa519d2e5ff11 (diff) | |
Prevented deletion of frequency if it's the only one in the network
Diffstat (limited to 'internal/client/ui')
| -rw-r--r-- | internal/client/ui/core/frequencylist/frequencylist.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/client/ui/core/frequencylist/frequencylist.go b/internal/client/ui/core/frequencylist/frequencylist.go index bc4ef05..d2e7dc5 100644 --- a/internal/client/ui/core/frequencylist/frequencylist.go +++ b/internal/client/ui/core/frequencylist/frequencylist.go @@ -116,6 +116,11 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { m.index = min(m.FrequenciesLength()-1, m.index+1) case "ctrl+d": + if len(m.Network().Frequencies) == 1 { + // Don't delete the last frequency! + return m, nil + } + // TODO: consider adding a confirmation popup frequencyId := m.Network().Frequencies[m.index].ID return m, gateway.Send(&packet.DeleteFrequency{ Frequency: frequencyId, |
