Check that a variable is set before trying to use it

This commit is contained in:
nikki 2014-08-15 04:46:15 +02:00
parent 53543993c2
commit f4fc0abf9f

View file

@ -427,7 +427,7 @@ function parseDiscogsRelease(data) {
}
// Track number (only for Vinyl and Cassette)
if ( release.discs[releaseNumber-1].format.match(/(Vinyl|Cassette)/)
if (release.discs[releaseNumber-1].format && release.discs[releaseNumber-1].format.match(/(Vinyl|Cassette)/)
&& discogsTrack.position.match(/^[A-Z]+[\.-]?\d*/) ){
track.number = discogsTrack.position;
}