Commit 33e4b71f4e5cde63b100c3c0e38c4c6d56064e08

Thomas de Grivel 2023-01-18T06:40:42

fix error when losing connection

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/mpd_client.rb b/lib/mpd_client.rb
index 6c2c82d..7ae934d 100644
--- a/lib/mpd_client.rb
+++ b/lib/mpd_client.rb
@@ -302,6 +302,8 @@ module MPD
     def read_line
       line = @socket.gets
 
+      return if line.nil?
+
       raise 'Connection lost while reading line' unless line.end_with?("\n")
 
       if line.start_with?(ERROR_PREFIX)