[mb-commits] branch, mbs-5607, created. MBS-5607, don' t crash when serializing a release group without a primary type...

MusicBrainz Git Server <[email protected]>
Newsgroups gmane.comp.audio.musicbrainz.cvs
Message-ID <E1Te1PF-0000y9-QJ@wiley>
The branch, mbs-5607 has been created
        at  4aa6715db0a0aa0be285cba5206a4502e47d11be (commit)

- Log -----------------------------------------------------------------
commit 4aa6715db0a0aa0be285cba5206a4502e47d11be
Author: warp <[email protected]>
Date:   Thu Nov 29 11:29:46 2012 +0100

    MBS-5607, don't crash when serializing a release group without a primary type for json /ws/2.

diff --git a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ReleaseGroup.pm b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ReleaseGroup.pm
index 9f4f4d3..349d7fc 100644
--- a/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ReleaseGroup.pm
+++ b/lib/MusicBrainz/Server/WebService/Serializer/JSON/2/ReleaseGroup.pm
@@ -15,7 +15,8 @@ sub serialize
     my %body;
 
     $body{title} = $entity->name;
-    $body{"primary-type"} = $entity->primary_type->name;
+    $body{"primary-type"} = $entity->primary_type
+        ? $entity->primary_type->name : JSON::null;
     $body{"secondary-types"} = [ map {
         $_->name } $entity->all_secondary_types ];
     $body{"first-release-date"} = $entity->first_release_date->format;

-----------------------------------------------------------------------


hooks/post-receive
-- 
mb_server
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.