BaseModel.search might return nil
This commit is contained in:
parent
d66831ee8c
commit
03c2a3d5cd
|
@ -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