diff --git a/libi2pd_client/Torrents.cpp b/libi2pd_client/Torrents.cpp index 29d9c54c..2dcfaaef 100644 --- a/libi2pd_client/Torrents.cpp +++ b/libi2pd_client/Torrents.cpp @@ -1824,8 +1824,10 @@ namespace torrents if (piece.VerifyHash ()) { boost::asio::post (GetTorrentsTunnel ()->GetDiskIOService (), - [index, torrent = m_Torrent]() mutable + [index, t = std::weak_ptr (m_Torrent)]() mutable { + auto torrent = t.lock (); + if (!torrent) return; // torrent doesn't exist anymore auto fragments = torrent->GetPieceFileFragments (index); Piece& piece = torrent->GetPiece (index); for (auto& it: fragments)