aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/main.go b/main.go
index 0539e1a..53dc440 100644
--- a/main.go
+++ b/main.go
@@ -232,7 +232,11 @@ func wsEndpoint(w http.ResponseWriter, r *http.Request) {
initialCmds := [][]byte{}
if wrms.Playing {
- data, err := json.Marshal(newEvent("play", []Song{wrms.CurrentSong}))
+ var songs []Song
+ if currentSong := wrms.CurrentSong.Load(); currentSong != nil {
+ songs = []Song{*currentSong}
+ }
+ data, err := json.Marshal(newEvent("play", songs))
if err != nil {
llog.Error("Encoding the play event failed with %s", err)
return