Skip to content

Commit

Permalink
Fix warning from trying to access an uninitialized ivar.
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Davis <zenspider@chef.io>
  • Loading branch information
zenspider committed Nov 27, 2019
1 parent 45be8b4 commit de14dea
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/json/pure/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ def [](name)
if respond_to?(name)
__send__(name)
else
instance_variable_get("@#{name}")
instance_variable_get("@#{name}") if
instance_variables.include?("@#{name}".to_sym) # avoid warning
end
end

Expand Down

0 comments on commit de14dea

Please sign in to comment.