Commit befab240 by liyijie

Add nil error protect

parent c5640dd9
...@@ -80,8 +80,9 @@ module RailsApiAuthentication ...@@ -80,8 +80,9 @@ module RailsApiAuthentication
) )
else else
auth = AuthToken.find(oauth_type: oauth_type, oauth_id: oauth_id)&.first auth = AuthToken.find(oauth_type: oauth_type, oauth_id: oauth_id)&.first
user = self.find_by(id: auth.oid) user = self.find_by(id: auth&.oid)
raise(UserError.new(401, '-1', 'Unauthorized')) unless user.present? raise(UserError.new(401, '-1', 'Unauthorized')) unless user.present?
auth
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment