client_test fix

This commit is contained in:
Arvid Norberg 2007-09-27 16:14:24 +00:00
parent c0195ae221
commit 09c1e0f007
1 changed files with 8 additions and 6 deletions

View File

@ -488,16 +488,18 @@ void scan_dir(path const& dir_path
// remove the torrents that are no longer in the directory
for (handles_t::iterator i = handles.begin()
, end(handles.end()); i != end; ++i)
for (handles_t::iterator i = handles.begin(); !handles.empty() && i != handles.end();)
{
if (i->first.empty()) continue;
if (valid.find(i->first) != valid.end()) continue;
if (i->first.empty() || valid.find(i->first) != valid.end())
{
++i;
continue;
}
torrent_handle& h = i->second;
if (!h.is_valid())
{
handles.erase(i--);
handles.erase(i);
continue;
}
@ -512,7 +514,7 @@ void scan_dir(path const& dir_path
bencode(std::ostream_iterator<char>(out), data);
}
ses.remove_torrent(h);
handles.erase(i--);
handles.erase(i);
}
}