Skip to content

Commit 237e681

Browse files
committed
⚡ Don't send HTTP get request when #M.xps == 0
1 parent cd11d0e commit 237e681

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lua/code-stats.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,13 +703,15 @@ end
703703
---@param xp integer
704704
function M.add_xp(filetype, xp)
705705
local language_type = M.filetypes[filetype] or filetype
706-
M.xps[language_type] = M.xps[language_type] or 0
707-
M.xps[language_type] = M.xps[language_type] + xp
706+
M.xps[language_type] = (M.xps[language_type] or 0) + xp
708707
end
709708

710709
---send xp
711710
---@return table
712711
function M.send_xp()
712+
if #M.xps == 0 then
713+
return {}
714+
end
713715
local xps = M.xps
714716
M.xps = {}
715717
local args = M.args

0 commit comments

Comments
 (0)