Skip to content

Commit

Permalink
fix: tostring(vim.version()) fails if build is NIL #24097
Browse files Browse the repository at this point in the history
Problem:
Since #23925, Version.build may be vim.NIL, which causes tostring() to fail:
    E5108: Error executing lua E5114: Error while converting print argument #1: …/version.lua:129:
    attempt to concatenate field 'build' (a userdata value)
    stack traceback:
            [C]: in function 'print'
            [string ":lua"]:1: in main chunk

Solution:
Handle vim.NIL in Version:__tostring().
  • Loading branch information
perrin4869 committed Jun 22, 2023
1 parent 08db61b commit 43e76cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/lua/vim/version.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ function Version:__tostring()
if self.prerelease then
ret = ret .. '-' .. self.prerelease
end
if self.build then
if self.build and self.build ~= vim.NIL then
ret = ret .. '+' .. self.build
end
return ret
Expand Down

0 comments on commit 43e76cc

Please sign in to comment.