mirror of
https://github.com/transmission/transmission
synced 2025-02-22 06:00:41 +00:00
Merge pull request #2676 from transmission/fix/2667-bitfield-assertion-on-zero-byte-file
fix: bitfield assertion failure on zero-byte file
This commit is contained in:
commit
41b13db874
1 changed files with 2 additions and 2 deletions
|
@ -2002,9 +2002,9 @@ tr_block_span_t tr_torGetFileBlockSpan(tr_torrent const* tor, tr_file_index_t i)
|
||||||
auto const [begin_byte, end_byte] = tor->fpm_.byteSpan(i);
|
auto const [begin_byte, end_byte] = tor->fpm_.byteSpan(i);
|
||||||
|
|
||||||
auto const begin_block = tor->byteLoc(begin_byte).block;
|
auto const begin_block = tor->byteLoc(begin_byte).block;
|
||||||
if (begin_byte >= end_byte)
|
if (begin_byte >= end_byte) // 0-byte file
|
||||||
{
|
{
|
||||||
return { begin_block, begin_block };
|
return { begin_block, begin_block + 1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const final_block = tor->byteLoc(end_byte - 1).block;
|
auto const final_block = tor->byteLoc(end_byte - 1).block;
|
||||||
|
|
Loading…
Reference in a new issue