Skip to content

Commit

Permalink
fix error caching if song is null
Browse files Browse the repository at this point in the history
  • Loading branch information
keshon committed Dec 7, 2024
1 parent 32163e4 commit 3cd1b14
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions player/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@ PLAYBACK_LOOP:

if output.ExitCode == 0 {
time.Sleep(5 * time.Second)
p.Song.StreamURL = path
cacheReady <- true
if p.Song != nil {
p.Song.StreamURL = path
cacheReady <- true
} else {
cacheReady <- false
}
}

fmt.Println("Caching is done, switching to playback from cache")
Expand Down Expand Up @@ -256,8 +260,9 @@ PLAYBACK_LOOP:
p.Song = nil
isCached = false
continue PLAYBACK_LOOP
} else {
p.ActionSignals <- ActionStop
}
p.ActionSignals <- ActionStop
case ActionStop:
p.StatusSignals <- StatusResting
return p.leaveVoiceChannel(vc)
Expand Down

0 comments on commit 3cd1b14

Please sign in to comment.