mirror of
https://github.com/transmission/transmission
synced 2024-12-23 00:04:06 +00:00
fix: "Nullptr with nonzero offset" (#3941)
This commit is contained in:
parent
4f957657d1
commit
33afdc32f9
1 changed files with 4 additions and 1 deletions
|
@ -211,7 +211,10 @@ int readOrWritePiece(tr_torrent* tor, IoMode io_mode, tr_block_info::Location lo
|
||||||
uint64_t const bytes_this_pass = std::min(uint64_t{ buflen }, uint64_t{ tor->fileSize(file_index) - file_offset });
|
uint64_t const bytes_this_pass = std::min(uint64_t{ buflen }, uint64_t{ tor->fileSize(file_index) - file_offset });
|
||||||
|
|
||||||
err = readOrWriteBytes(tor->session, tor, io_mode, file_index, file_offset, buf, bytes_this_pass);
|
err = readOrWriteBytes(tor->session, tor, io_mode, file_index, file_offset, buf, bytes_this_pass);
|
||||||
buf += bytes_this_pass;
|
if (buf != nullptr)
|
||||||
|
{
|
||||||
|
buf += bytes_this_pass;
|
||||||
|
}
|
||||||
buflen -= bytes_this_pass;
|
buflen -= bytes_this_pass;
|
||||||
|
|
||||||
if (err != 0 && io_mode == IoMode::Write && tor->error != TR_STAT_LOCAL_ERROR)
|
if (err != 0 && io_mode == IoMode::Write && tor->error != TR_STAT_LOCAL_ERROR)
|
||||||
|
|
Loading…
Reference in a new issue