Skip to content

Commit

Permalink
fix: prevent potential arithmetic operation against nil (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
ribru17 committed Jul 14, 2023
1 parent e6adb87 commit 9d121c1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lua/nvim-autopairs/conds.lua
Expand Up @@ -43,7 +43,7 @@ cond.before_regex = function(regex, length)
---@param opts CondOpts
return function(opts)
log.debug('before_regex')
local str = utils.text_sub_char(opts.line, opts.col - 1, length - opts.col)
local str = utils.text_sub_char(opts.line, opts.col - 1, length or -opts.col)
if str:match(regex) then
return true
end
Expand Down

0 comments on commit 9d121c1

Please sign in to comment.