Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bri cassa 2021-08-04 21:42:16 +02:00
commit b91fe92d13
1 changed files with 3 additions and 1 deletions

View File

@ -164,7 +164,9 @@ end
function mesecon.get_bit(binary,bit)
bit = bit or 1
local c = binary:len()-(bit-1)
local len = binary:len()
if bit > len then return false end
local c = len-(bit-1)
return binary:sub(c,c) == "1"
end