Skip to content

Commit a9a9e21

Browse files
committed
fix crash if bot is alone
1 parent 4a7e4b4 commit a9a9e21

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

plugins/control.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,15 @@ def state_handling_if_alone()
9696
if @@bot[:mpd]
9797
current = @@bot[:mpd].current_song
9898

99-
if current.file.include? "://" #If yes, it is probably some kind of a stream.
100-
@@bot[:mpd].stop
101-
@playing = false
102-
else
103-
if @@bot[:mpd].paused? == false
104-
@@bot[:mpd].pause = true
99+
if ! current.nil?
100+
if current.file.include? "://" #If yes, it is probably some kind of a stream.
101+
@@bot[:mpd].stop
105102
@playing = false
103+
else
104+
if @@bot[:mpd].paused? == false
105+
@@bot[:mpd].pause = true
106+
@playing = false
107+
end
106108
end
107109
end
108110
end

0 commit comments

Comments
 (0)