fix for loading 0-size torrent files. Fixes #383

This commit is contained in:
Arvid Norberg 2008-10-05 04:52:01 +00:00
parent d4c5d5835a
commit 7f0bfa37b9
1 changed files with 1 additions and 0 deletions

View File

@ -229,6 +229,7 @@ namespace libtorrent
if (ec) return -1;
if (s > 5000000) return -2;
v.resize(s);
if (s == 0) return 0;
f.seek(0, file::begin, ec);
if (ec) return -1;
size_type read = f.read(&v[0], s, ec);