From 0327c73263fd621df48c6842f91c93fac91be568 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 2 Nov 2012 04:34:17 +0000 Subject: [PATCH] merged fix RC_0_16 --- ChangeLog | 1 + src/torrent.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 66f1049cc..da1a47c08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ * fix uTP edge case where udp socket buffer fills up * fix nagle implementation in uTP + * fix potential crash when using torrent_handle::add_piece * added missing add_torrent_alert to python binding 0.16.5 release diff --git a/src/torrent.cpp b/src/torrent.cpp index b70c4b063..d69c01ca3 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -3103,6 +3103,11 @@ namespace libtorrent TORRENT_ASSERT(valid_metadata()); + // it's possible to get here if the last piece was downloaded + // from peers and inserted with add_piece at the same time. + // if we're a seed, we won't have a piece picker, and can't continue + if (is_seed()) return; + TORRENT_ASSERT(!m_picker->have_piece(index)); state_updated();