Fixed Error

Removed accidentally multiplying displacement by 8 twice
This commit is contained in:
2025-09-16 10:37:37 -06:00
committed by GitHub
parent 49ecc6b430
commit f050d8285d

View File

@@ -142,7 +142,13 @@ class BZZCompressor:
# Here we copy bit by bit from earlier in the output buffer. # Here we copy bit by bit from earlier in the output buffer.
# we use this instead of index slicing since the slice could lead to # we use this instead of index slicing since the slice could lead to
# data we are currently copying into the buffer # data we are currently copying into the buffer
start_index = len(output_buffer) - int(displacement.to01(), 2) start_index = len(output_buffer) - displacement
# If start index is less than 0, we'll be checking something like output_buffer[-2]
# or smth, which will have an IndexOutOfBounds exception
if start_index < 0:
print("Error decompressing file. Start Index was out of range.")
return
for i in range(length): for i in range(length):
output_buffer.append(output_buffer[start_index + i]) output_buffer.append(output_buffer[start_index + i])