mirror of
https://github.com/transmission/transmission
synced 2025-03-15 16:29:34 +00:00
fix: avoid unintentional map insertions in ActiveRequests::count() (#5520)
This commit is contained in:
parent
7cabeff24f
commit
69fc149f07
1 changed files with 3 additions and 1 deletions
|
@ -200,7 +200,9 @@ bool ActiveRequests::has(tr_block_index_t block, tr_peer const* peer) const
|
|||
// count how many peers we're asking for `block`
|
||||
size_t ActiveRequests::count(tr_block_index_t block) const
|
||||
{
|
||||
return std::size(impl_->blocks_[block]);
|
||||
auto const& blocks = impl_->blocks_;
|
||||
auto const iter = blocks.find(block);
|
||||
return iter == std::end(blocks) ? 0U : std::size(iter->second);
|
||||
}
|
||||
|
||||
// count how many active block requests we have to `peer`
|
||||
|
|
Loading…
Add table
Reference in a new issue