fix to torrent_info constructor to not try to access 0 pointer when loading a 0 size torrent file

This commit is contained in:
Arvid Norberg 2008-10-17 01:46:06 +00:00
parent 81636a894d
commit 0368e444af
1 changed files with 7 additions and 0 deletions

View File

@ -319,6 +319,13 @@ namespace libtorrent
int ret = load_file(filename, buf);
if (ret < 0) return;
if (buf.empty())
#ifndef BOOST_NO_EXCEPTIONS
throw invalid_torrent_file();
#else
return;
#endif
lazy_entry e;
lazy_bdecode(&buf[0], &buf[0] + buf.size(), e);
std::string error;