FIX: skip adding sso diagnostics if sso object is nil

FIX: skip adding sso diagnostics if sso object is nil
diff --git a/app/controllers/session_controller.rb b/app/controllers/session_controller.rb
index 0c0d7e6..8712276 100644
--- a/app/controllers/session_controller.rb
+++ b/app/controllers/session_controller.rb
@@ -116,7 +116,7 @@ class SessionController < ApplicationController
       sso = DiscourseSingleSignOn.parse(request.query_string)
     rescue DiscourseSingleSignOn::ParseError => e
       if SiteSetting.verbose_sso_logging
-        Rails.logger.warn("Verbose SSO log: Signature parse error\n\n#{e.message}\n\n#{sso.diagnostics}")
+        Rails.logger.warn("Verbose SSO log: Signature parse error\n\n#{e.message}\n\n#{sso&.diagnostics}")
       end
 
       # Do NOT pass the error text to the client, it would give them the correct signature

GitHub
sha: 1ea0cbec

1 Like