fix: update torrent progress when verifying partially completed pieces (#7143)

* fix: update torrent progress when verifying partially completed pieces

* chore: restrict scope of local variable
This commit is contained in:
Yat Ho 2024-10-14 08:15:21 +08:00 committed by GitHub
parent f5997eb5ed
commit 61ecad4c43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 3 deletions

View File

@ -1699,9 +1699,7 @@ void tr_torrent::VerifyMediator::on_verify_started()
void tr_torrent::VerifyMediator::on_piece_checked(tr_piece_index_t const piece, bool const has_piece)
{
auto const had_piece = tor_->has_piece(piece);
if (has_piece != had_piece)
if (auto const had_piece = tor_->has_piece(piece); !has_piece || !had_piece)
{
tor_->set_has_piece(piece, has_piece);
tor_->set_dirty();