From 848d9f5fc1cb49ea1019910e5e0d1431fdc3a317 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 19 Jan 2010 01:58:03 +0000 Subject: [PATCH] don't crash when trying to make a torrent from 0 files --- src/create_torrent.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/create_torrent.cpp b/src/create_torrent.cpp index 96fe84550..43739bc0d 100644 --- a/src/create_torrent.cpp +++ b/src/create_torrent.cpp @@ -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