arsduo/koala — Issue #168: undefined method `[]' for nil:NilClass
Author: stefanobernardi
Created: 2012-02-20 08:35:00+00:00
State: open

Hi there,
thanks for Koala. It's awesome.

I have a weird problem, while trying to parse my feed.

My code:

@feed.each do |f|
f["likes"]["data"].each do |like|
puts like
end
end

I get a lot of likes printed but after a bit I always get a:

NoMethodError: undefined method `[]' for nil:NilClass
from (irb):208:in `block in irb_binding'
from (irb):207:in `each'
from (irb):207
from /Users/ste/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `

'

I tried an if block to test the presence of data, but that doesn't help.

This only happens on the data key of the likes, not on the likes key.. very weird. Any ideas?
Thanks.