Fix (again!) dealing with CDs with no release events
authorSteve McIntyre <steve@einval.com>
Fri, 9 Mar 2018 15:04:27 +0000 (15:04 +0000)
committerSteve McIntyre <steve@einval.com>
Fri, 9 Mar 2018 15:04:27 +0000 (15:04 +0000)
The rewrite with API v2 lost this fix - some CDs don't have release
events in Musicbrainz. Cope with that...

abcde-musicbrainz-tool

index 0a5bf77..6d2c675 100755 (executable)
@@ -116,12 +116,12 @@ if ($command =~ m/^id/) {
             $va = 1;
         }
 
-        my @release_events = @{ $release->{'release-events'} };
-
-        if (@release_events > 0) {
-            $rel_year =  substr(@release_events[0]->{'date'},0,4);
-        }
-
+       if ($release->{'release-events'}) {
+           my @release_events = @{ $release->{'release-events'} };
+           if (@release_events > 0) {
+               $rel_year =  substr(@release_events[0]->{'date'},0,4);
+           }
+       }
         $releasenum++;
         open (OUT, "> $workdir/cddbread.$releasenum");
         binmode OUT, ":utf8";