From 60d4df1cab3a20f43e7bccf49f90eee97d0bfe38 Mon Sep 17 00:00:00 2001 From: Mathias Gawlista Date: Mon, 1 Dec 2014 11:35:39 +0100 Subject: [PATCH] BaseModel.search might return nil --- lib/musicbrainz/models/release_group.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/musicbrainz/models/release_group.rb b/lib/musicbrainz/models/release_group.rb index 2129830..66062c2 100644 --- a/lib/musicbrainz/models/release_group.rb +++ b/lib/musicbrainz/models/release_group.rb @@ -35,7 +35,7 @@ module MusicBrainz def find_by_artist_and_title(artist_name, title, type = nil ) matches = search(artist_name, title, type) - matches.empty? ? nil : find(matches.first[:id]) + matches.nil? || matches.empty? ? nil : find(matches.first[:id]) end end end