Fix hexdump math-error on empty input

master
LEdoian 10 months ago
parent 3c55290383
commit c2c749f0f7

@ -25,7 +25,7 @@ class Direction:
def hexdump(data: bytes) -> list[str]: # We will be prefixing the lines with sigils, so no need to join.
result = []
offset = 0
offset_len = math.ceil(math.log(len(data), 16))
offset_len = math.ceil(math.log(len(data)+1, 16))
while data:
left_chunk, right_chunk, data = data[:8], data[8:16], data[16:]
left_ascii = ''.join(chr(x) if x in range(32,127) else '.' for x in left_chunk)

Loading…
Cancel
Save