diff --git a/ChangeLog b/ChangeLog index c8925c0a..f84071d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-11-23 Tatsuhiro Tsujikawa + + Fixed the bug that causes floating exception when -T option is used and + no URIs are given. + * src/download_helper.cc + * test/DownloadHelperTest.cc + 2008-11-22 Ross Smith II Applied aria2-1.0.0-mingw-r5.patch to fix numerous compile/unit test diff --git a/src/download_helper.cc b/src/download_helper.cc index 177faa9b..be8b8016 100644 --- a/src/download_helper.cc +++ b/src/download_helper.cc @@ -79,7 +79,7 @@ static void splitURI(std::deque& result, size_t numURIs = std::distance(begin, end); if(numURIs >= numSplit) { result.insert(result.end(), begin, end); - } else { + } else if(numURIs > 0) { for(size_t i = 0; i < numSplit/numURIs; ++i) { result.insert(result.end(), begin, end); } diff --git a/test/DownloadHelperTest.cc b/test/DownloadHelperTest.cc index a0f94058..71e9b1ee 100644 --- a/test/DownloadHelperTest.cc +++ b/test/DownloadHelperTest.cc @@ -360,6 +360,18 @@ void DownloadHelperTest::testCreateRequestGroupForBitTorrent() } CPPUNIT_ASSERT_EQUAL((unsigned int)5, group->getNumConcurrentCommand()); } + { + // no URIs are given + std::deque > result; + std::deque emptyURIs; + createRequestGroupForBitTorrent(result, &op, emptyURIs); + + CPPUNIT_ASSERT_EQUAL((size_t)1, result.size()); + SharedHandle group = result[0]; + std::deque uris; + group->getURIs(uris); + CPPUNIT_ASSERT_EQUAL((size_t)0, uris.size()); + } op.put(PREF_FORCE_SEQUENTIAL, V_TRUE); { std::deque > result;