From 303c818f6c10752d52084f6a4d456a788e49b624 Mon Sep 17 00:00:00 2001 From: "FUJI Goro (gfx)" Date: Tue, 11 Apr 2017 13:19:41 +0900 Subject: [PATCH] avoid nil errors in API authentication --- app/controllers/kuroko2/api/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/kuroko2/api/application_controller.rb b/app/controllers/kuroko2/api/application_controller.rb index 097e94b5..6798f720 100644 --- a/app/controllers/kuroko2/api/application_controller.rb +++ b/app/controllers/kuroko2/api/application_controller.rb @@ -31,7 +31,7 @@ def respond_with_error(status_code, error_code, message) def api_authentication service_name = authenticate_with_http_basic do |name, api_key| stored = Kuroko2.config.api_basic_authentication_applications.try!(name.to_sym) - if Rack::Utils.secure_compare(api_key, stored) + if stored && Rack::Utils.secure_compare(api_key, stored) name.to_sym else nil