[Core] Fix `FileAccessCompressed.get_buffer` size error on multiples of block size

This commit is contained in:
A Thousand Ships 2024-08-01 15:42:56 +02:00
parent fd7239cfab
commit 02cb608d5a
No known key found for this signature in database
GPG Key ID: 2033189A662F8BD7
1 changed files with 8 additions and 0 deletions

View File

@ -316,6 +316,14 @@ uint64_t FileAccessCompressed::get_buffer(uint8_t *p_dst, uint64_t p_length) con
read_block_size = read_block == read_block_count - 1 ? read_total % block_size : block_size;
read_pos = 0;
if (read_block_size == 0) {
at_end = true;
if (i + 1 < p_length) {
read_eof = true;
}
return i + 1;
}
} else {
read_block--;
at_end = true;