ruby-mpd icon indicating copy to clipboard operation
ruby-mpd copied to clipboard

song_with_id( nil ) causes error

Open Phrogz opened this issue 9 years ago • 0 comments

A silly edge case, but:

begin; @mpd.song_with_id(1); rescue MPD::Error=>e; puts e; end
#=> [playlistid] No such song

begin; @mpd.song_with_id(-1); rescue MPD::Error=>e; puts e; end
#=> [playlistid] Number too large: -1

begin; @mpd.song_with_id('cat'); rescue MPD::Error=>e; puts e; end
#=> [playlistid] Integer expected: cat

begin; @mpd.song_with_id(nil); rescue MPD::Error=>e; puts e; end
NoMethodError: undefined method `delete' for true:TrueClass
        from /var/lib/gems/2.1.0/gems/ruby-mpd-0.3.3/lib/ruby-mpd/song.rb:13:in `initialize'
        from /var/lib/gems/2.1.0/gems/ruby-mpd-0.3.3/lib/ruby-mpd/plugins/queue.rb:81:in `new'
        from /var/lib/gems/2.1.0/gems/ruby-mpd-0.3.3/lib/ruby-mpd/plugins/queue.rb:81:in `song_with_id'
        ...

Phrogz avatar Jan 21 '16 15:01 Phrogz