archseer / ruby-mpd

ruby-mpd is a powerful object-oriented Music Player Daemon library, forked from librmpd.
GNU General Public License v2.0
83 stars 32 forks source link

Error in make_chunks in parser.rb #39

Closed HCLarsen closed 9 years ago

HCLarsen commented 9 years ago

I tried using your gem today, and I get the following error when I try to run any commands. Seems that the regex in the make_chunks command returns Nil, and that's causing an error in the match command that exits the entire program.

/home/pi/.rvm/gems/ruby-2.2.1/gems/ruby-mpd-0.3.3/lib/ruby-mpd/parser.rb:129:in `make_chunks': undefined method `[]' for nil:NilClass (NoMethodError)
    from /home/pi/.rvm/gems/ruby-2.2.1/gems/ruby-mpd-0.3.3/lib/ruby-mpd/parser.rb:155:in `build_response'
    from /home/pi/.rvm/gems/ruby-2.2.1/gems/ruby-mpd-0.3.3/lib/ruby-mpd/parser.rb:147:in `parse_response'
    from /home/pi/.rvm/gems/ruby-2.2.1/gems/ruby-mpd-0.3.3/lib/ruby-mpd.rb:195:in `block in send_command'
    from /home/pi/.rvm/gems/ruby-2.2.1/gems/ruby-mpd-0.3.3/lib/ruby-mpd.rb:191:in `synchronize'
    from /home/pi/.rvm/gems/ruby-2.2.1/gems/ruby-mpd-0.3.3/lib/ruby-mpd.rb:191:in `send_command'
    from /home/pi/.rvm/gems/ruby-2.2.1/gems/ruby-mpd-0.3.3/lib/ruby-mpd/plugins/controls.rb:29:in `play'
    from radio.rb:10:in `block in <main>'
    from radio.rb:5:in `loop'
    from radio.rb:5:in `<main>'
mikerodrigues commented 9 years ago

What version of MPD are you using? Can you provide the code that you ran to throw this error? I just checked out the latest git version and I'm able to send commands successfully.

HCLarsen commented 9 years ago

Sorry, in the attempt to recreate the code that threw this error, I discovered that the error was mine. I did not connect to the mpd server. When I add mpd.connect to my code, the error doesn't happen.