1
0
Fork 0

BaseModel.search might return nil

This commit is contained in:
Linus Oleander 2013-11-06 22:37:31 +01:00
parent d66831ee8c
commit 03c2a3d5cd
1 changed files with 3 additions and 1 deletions

View File

@ -36,7 +36,9 @@ module MusicBrainz
def find_by_name(name) def find_by_name(name)
matches = search(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 end
end end