From f4fc0abf9f1e4a50236bd7a7de098c9052c5f980 Mon Sep 17 00:00:00 2001 From: nikki Date: Fri, 15 Aug 2014 04:46:15 +0200 Subject: [PATCH] Check that a variable is set before trying to use it --- discogs_importer.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discogs_importer.user.js b/discogs_importer.user.js index 52937ee..9d22fa4 100644 --- a/discogs_importer.user.js +++ b/discogs_importer.user.js @@ -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; }