aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Garrelou <simon.garrelou@gmail.com>2022-12-12 20:38:34 +0100
committerSimon Garrelou <simon.garrelou@gmail.com>2022-12-12 20:38:34 +0100
commitf1df9f6faef276bb20de0bb6a78873082194c0e2 (patch)
treec1dec4e07e686b2721cbca0322031490dc9c3dff
parent36a1f025e58489310c414282b2a0ffc14afc9a99 (diff)
downloadtermsonic-f1df9f6faef276bb20de0bb6a78873082194c0e2.tar.gz
termsonic-f1df9f6faef276bb20de0bb6a78873082194c0e2.zip
Do not allow to switch to other tabs if config isn't good
-rw-r--r--src/app.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/app.go b/src/app.go
index b998a50..173132c 100644
--- a/src/app.go
+++ b/src/app.go
@@ -126,6 +126,9 @@ func Run(cfg *Config) {
126func (a *app) switchToPage(name string) { 126func (a *app) switchToPage(name string) {
127 switch name { 127 switch name {
128 case "artists": 128 case "artists":
129 if a.sub == nil {
130 return
131 }
129 if !a.artistsLoaded { 132 if !a.artistsLoaded {
130 if err := a.refreshArtists(); err != nil { 133 if err := a.refreshArtists(); err != nil {
131 a.alert("Error: %v", err) 134 a.alert("Error: %v", err)
@@ -137,11 +140,17 @@ func (a *app) switchToPage(name string) {
137 a.tv.SetFocus(a.artistsTree) 140 a.tv.SetFocus(a.artistsTree)
138 a.pages.SetBorder(false) 141 a.pages.SetBorder(false)
139 case "playqueue": 142 case "playqueue":
143 if a.sub == nil {
144 return
145 }
140 a.pages.SwitchToPage("playqueue") 146 a.pages.SwitchToPage("playqueue")
141 a.headerSections.Highlight("playqueue") 147 a.headerSections.Highlight("playqueue")
142 a.tv.SetFocus(a.playQueueList) 148 a.tv.SetFocus(a.playQueueList)
143 a.pages.SetBorder(true) 149 a.pages.SetBorder(true)
144 case "playlists": 150 case "playlists":
151 if a.sub == nil {
152 return
153 }
145 if !a.playlistsLoaded { 154 if !a.playlistsLoaded {
146 if err := a.refreshPlaylists(); err != nil { 155 if err := a.refreshPlaylists(); err != nil {
147 a.alert("Error: %v", err) 156 a.alert("Error: %v", err)