Save Compression Update

This commit is contained in:
xl3lackout
2022-04-11 17:53:01 -04:00
parent 92a09edc96
commit cfb870d4ad

View File

@@ -70,10 +70,15 @@ func Compress(rawData []byte) ([]byte, error) {
if err == io.EOF {
output = append(output, []byte{byte(nullCount)}...)
break
} else if i != 0 {
} else if i != 0 && nullCount != 0 {
r.UnreadByte()
output = append(output, []byte{byte(nullCount)}...)
break
} else if i != 0 && nullCount == 0 {
r.UnreadByte()
output = output[:len(output)-2]
output = append(output, []byte{byte(0xFF)}...)
break
} else if err != nil {
return nil, err
}
@@ -90,4 +95,4 @@ func Compress(rawData []byte) ([]byte, error) {
}
}
return output, nil
}
}