Skip to content

Commit d8dfa06

Browse files
committed
fix: Swallow errors when parsing albumArtURI in getting current track
In case a parsing error occurs attempting to create albumArtURL, just log the problem to console rather than throwing an exception and failing out.
1 parent 4744fe7 commit d8dfa06

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/services/AVTransport.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,13 @@ class AVTransport extends Service {
196196
const track = Helpers.ParseDIDL(metadata)
197197
track.position = position
198198
track.duration = duration
199-
track.albumArtURL = !track.albumArtURI ? null
200-
: track.albumArtURI.startsWith('http') ? track.albumArtURI
201-
: 'http://' + this.host + ':' + this.port + track.albumArtURI
199+
try {
200+
track.albumArtURL = !track.albumArtURI ? null
201+
: track.albumArtURI.startsWith('http') ? track.albumArtURI
202+
: 'http://' + this.host + ':' + this.port + track.albumArtURI
203+
} catch (err) {
204+
console.log('Could not parse this albumArtURI into albumArtURL: ', track.albumArtURI)
205+
}
202206
if (trackUri) track.uri = trackUri
203207
track.queuePosition = queuePosition
204208
return track

0 commit comments

Comments
 (0)