From 33c72ecab021ddd74cf1896b80d2cf75ba7b627b Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Mon, 11 Jan 2021 15:55:34 +0100 Subject: [PATCH] Defend from nil BETA_TESTERS var --- lib/open_food_network/feature_toggle.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/open_food_network/feature_toggle.rb b/lib/open_food_network/feature_toggle.rb index 12aaa90a038..5ee51a82f9b 100644 --- a/lib/open_food_network/feature_toggle.rb +++ b/lib/open_food_network/feature_toggle.rb @@ -31,6 +31,8 @@ def self.enabled?(feature_name, user = nil) end def self.enable(feature_name, user_emails) + return unless user_emails.present? + Thread.current[:features] ||= {} Thread.current[:features][feature_name] = Feature.new(user_emails) end