don't crash when trying to make a torrent from 0 files

This commit is contained in:
Arvid Norberg 2010-01-19 01:58:03 +00:00
parent f20df9211a
commit 848d9f5fc1
1 changed files with 4 additions and 0 deletions

View File

@ -115,6 +115,10 @@ namespace libtorrent
, m_merkle_torrent(flags & merkle)
{
TORRENT_ASSERT(fs.num_files() > 0);
// return instead of crash in release mode
if (fs.num_files() == 0) return;
if (!m_multifile && has_parent_path(m_files.at(0).path)) m_multifile = true;
// a piece_size of 0 means automatic