Merge pull request #24 from oleander/nil_result
BaseModel.search might return nil
This commit is contained in:
commit
35b32bddf4
|
@ -36,7 +36,9 @@ module MusicBrainz
|
|||
|
||||
def find_by_name(name)
|
||||
matches = search(name)
|
||||
matches.empty? ? nil : find(matches.first[:id])
|
||||
if matches and not matches.empty?
|
||||
find(matches.first[:id])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue