Skip to content

Commit

Permalink
Avoid toggles nil exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinya Maeda authored and rarruda committed Oct 26, 2018
1 parent 3aeb53b commit 397ca48
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/unleash/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def initialize(*opts)
def is_enabled?(feature, context = nil, default_value = false)
Unleash.logger.debug "Unleash::Client.is_enabled? feature: #{feature} with context #{context}"

toggle_as_hash = Unleash.toggles.select{ |toggle| toggle['name'] == feature }.first
toggle_as_hash = Unleash.toggles.select{ |toggle| toggle['name'] == feature }.first if Unleash.toggles

if toggle_as_hash.nil?
Unleash.logger.debug "Unleash::Client.is_enabled? feature: #{feature} not found"
Expand Down

0 comments on commit 397ca48

Please sign in to comment.