Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nascarsayan authored Aug 19, 2024
1 parent 573f9a1 commit eca0e83
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sqids.lua
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ function Sqids:encode(numbers)
return ''
end

-- don't allow out-of-range numbers
for _, n in ipairs(numbers) do
if n < 0 or n > maxValue() then
error("Encoding supports numbers between 0 and " .. maxValue())
end
end

return encodeNumbers(self, numbers)
end

Expand Down

0 comments on commit eca0e83

Please sign in to comment.