Rolamix / cordova-plugin-playlist

🎶 A Cordova plugin for Android and iOS with native support for audio playlists, background support, and lock screen controls 🎶
MIT License
33 stars 33 forks source link

Searching for track not on playlist causes crash (iOS) #14

Closed robinbanbury closed 5 years ago

robinbanbury commented 6 years ago

Expected Behaviour

Searching for a trackId that is not on the current playlist should indicate that the track is not present (e.g. could return index -1)

Actual Behaviour

Terminates with uncaught exception

screen shot 2018-08-15 at 12 57 08

Reproduce Scenario (including but not limited to)

iOS with Ionic, streaming tracks

Steps to Reproduce

Add some tracks to a playlist, then try playing one of those tracks using a non-existant trackId, e.g. this.cdvAudioPlayer.playTrackById('1234567890');

Platform and Version

iOS 11.4

Cordova CLI version and cordova platform version

Cordova CLI version 7.1.0

Logs taken while reproducing problem

2018-08-15 12:56:33.947374+0100 GigLicker[9622:3395198] AudioPlayerSuccessCb [setPlaylistItems]:
2018-08-15 12:56:33.947454+0100 GigLicker[9622:3395198] New playlist set
2018-08-15 12:56:33.947509+0100 GigLicker[9622:3395198] RmxAudioPlayer.execute=playTrackById, 1234567890
2018-08-15 12:56:33.948641+0100 GigLicker[9622:3395198] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(0x183566d8c 0x1827205ec 0x1834ff750 0x1834380cc 0x183437f48 0x1030991a4 0x10308fd70 0x1030ae904 0x102f542bc 0x102f54120 0x102f55d9c 0x193273a2c 0x193210734 0x1932128a4 0x192f79d18 0x1931b920c 0x192f3ccfc 0x192f3f704 0x18ab9e17c 0x18ab9e3ec 0x18350f404 0x18350ec2c 0x18350c79c 0x18342cda8 0x185412020 0x18d44c758 0x102f496ec 0x182ebdfc0)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) frame variable
(RmxAudioPlayer *) self = 0x00000001c00d6ff0
(SEL) _cmd = "findTrackById:"
(__NSCFString *) trackId = 0x00000001c42379e0 @"1234567890"
(NSInteger) idx = -1
(AudioTrack *) track = nil
codinronan commented 5 years ago

Also fixed :)