Permalink
Browse files

fix for no photos found

  • Loading branch information...
1 parent 912e765 commit d63a88891988e86c949a6aee58a176cec7375f5b @akwiatkowski akwiatkowski committed Feb 26, 2011
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/panoramio.rb
View
@@ -33,6 +33,11 @@ def to_uri(options)
end
def to_photos(json)
+ # fix for 'no photos''
+ if json['photos'].first.nil?
+ return Array.new
+ end
+
struct = Struct.new('Photo', *json['photos'].first.keys)
json['photos'].map {|p| struct.new(*p.values) }
end

0 comments on commit d63a888

Please sign in to comment.