File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package backend
22
33import (
44 "context"
5+ "errors"
56 "fmt"
67 "log"
78 "math/rand"
@@ -480,11 +481,15 @@ func (p *PlaybackManager) PlaySimilarSongs(id string) error {
480481}
481482
482483func (p * PlaybackManager ) PlayRandomAlbums (genreName string ) error {
484+ mp := p .engine .sm .GetServer ()
485+ if mp == nil {
486+ return errors .New ("logged out" )
487+ }
488+
483489 if p .engine .replayGainCfg .Mode == ReplayGainAuto {
484490 p .SetReplayGainMode (player .ReplayGainAlbum )
485491 }
486492
487- mp := p .engine .sm .Server
488493 var options mediaprovider.AlbumFilterOptions
489494 if genreName != "" {
490495 options = mediaprovider.AlbumFilterOptions {
@@ -495,6 +500,9 @@ func (p *PlaybackManager) PlayRandomAlbums(genreName string) error {
495500 insertMode := Replace
496501 for i := 0 ; i < 20 ; i ++ {
497502 al := iter .Next ()
503+ if al == nil {
504+ break
505+ }
498506 if al , err := mp .GetAlbum (al .ID ); err == nil {
499507 p .LoadTracks (al .Tracks , insertMode , false )
500508 if i == 0 {
You can’t perform that action at this time.
0 commit comments