27498da2ba
git-svn-id: svn://svn.openwrt.org/openwrt/packages@18421 3c298f89-4303-0410-b956-a3cf2f4a3e73
14 lines
567 B
Diff
14 lines
567 B
Diff
# Fix crash when trying to call d.get_bitfield on a closed download. Ticket #1825 from libtorrent.rakshasa.no.
|
|
--- a/src/command_download.cc
|
|
+++ b/src/command_download.cc
|
|
@@ -296,6 +296,9 @@
|
|
|
|
torrent::Object
|
|
retrieve_d_bitfield(core::Download* download) {
|
|
+ if (!download->download()->file_list()->is_open())
|
|
+ throw torrent::input_error("Cannot retrieve bitfield of closed download.");
|
|
+
|
|
const torrent::Bitfield* bitField = download->download()->file_list()->bitfield();
|
|
|
|
return torrent::Object(rak::transform_hex(bitField->begin(), bitField->end()));
|