crispymtn / crispyfi

Makes music. Loud. https://www.crispymtn.com/stories/let-the-music-play
125 stars 17 forks source link

Crash: numTracks of null #7

Open jakeleboeuf opened 9 years ago

jakeleboeuf commented 9 years ago

Passed in a Spotify playlist uri and it crashed the app: play spotify:user:natecook7:playlist:7p0wjqToNjHfu4bzLvY3Vk

Returns:

/home/pi/Apps/crispyfi/lib/spotify_handler.coffee:141
.track.index = ++this.state.track.index % this.state.playlist.object.numTracks
                                                                    ^
TypeError: Cannot read property 'numTracks' of null
  at SpotifyHandler.get_next_track (/home/pi/Apps/crispyfi/lib/spotify_handler.coffee:164:73)
  at SpotifyHandler.skip (/home/pi/Apps/crispyfi/lib/spotify_handler.coffee:102:12)
  at IncomingMessage.<anonymous> (/home/pi/Apps/crispyfi/lib/slack_interface/request_handler.coffee:21:41)
  at IncomingMessage.g (events.js:180:16)
  at IncomingMessage.emit (events.js:117:20)
  at _stream_readable.js:944:16
  at process._tickCallback (node.js:442:13)
dkoch commented 9 years ago

Thanks for the notification, I'll have a look tomorrow.

dkoch commented 9 years ago

play is not supposed to take playlists as arguments but rather links to single files, e.g. spotify:track:6d5VZ3G9PED8DkIiwXcOBn. Playlists are handled using the list command.

Still, this shouldn't outright kill the app, so I'll fix this in a bit.