1
0
Fork 0
mirror of https://github.com/jiriks74/presence.nvim synced 2025-04-08 21:33:00 +02:00

Added nil protection for response.

This commit is contained in:
copypasteonly 2023-06-25 01:02:26 +08:00
parent 87c857a56b
commit f4b961bc73

View file

@ -355,8 +355,10 @@ function Presence:authorize(on_done)
return return
end end
if response ~= nil then
self.log:info(string.format("Authorized with Discord for %s", response.data.user.username)) self.log:info(string.format("Authorized with Discord for %s", response.data.user.username))
self.is_authorized = true self.is_authorized = true
end
if on_done then on_done() end if on_done then on_done() end
end) end)
@ -725,7 +727,6 @@ function Presence:get_buttons(buffer, parent_dirpath)
-- Default behavior to show a "View Repository" button if the repo URL is valid -- Default behavior to show a "View Repository" button if the repo URL is valid
if repo_url then if repo_url then
-- Check if repo url uses short ssh syntax -- Check if repo url uses short ssh syntax
local domain, project = repo_url:match("^git@(.+):(.+)$") local domain, project = repo_url:match("^git@(.+):(.+)$")
if domain and project then if domain and project then