From 6d961cdcc54d9fb350663da652cf0488aefa838f Mon Sep 17 00:00:00 2001 From: Ivan Sorokin Date: Wed, 14 May 2014 12:22:57 +0400 Subject: [PATCH] Don't show availability bar for magnet links This commit fixes an exception in PropertiesWidget: "Caught exception in PropertiesWidget::loadDynamicData(): invalid torrent handle used" This exception occurs when an user clicks on a torrent that doesn't have a metadata (when a magnet link is not resolved yet). One should not call torrent_handle::get_torrent_info when torrent doesn't have a metadata. --- src/properties/propertieswidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index 848c76bd9..b5aecaaef 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -333,14 +333,14 @@ void PropertiesWidget::loadDynamicData() { // Update ratio info const qreal ratio = QBtSession::instance()->getRealRatio(h.hash()); shareRatio->setText(ratio > QBtSession::MAX_RATIO ? QString::fromUtf8("∞") : misc::accurateDoubleToString(ratio, 2)); - if (!h.is_seed()) { + if (!h.is_seed() && h.has_metadata()) { showPiecesDownloaded(true); // Downloaded pieces bitfield bf(h.get_torrent_info().num_pieces(), 0); h.downloading_pieces(bf); downloaded_pieces->setProgress(h.pieces(), bf); // Pieces availability - if (h.has_metadata() && !h.is_paused() && !h.is_queued() && !h.is_checking()) { + if (!h.is_paused() && !h.is_queued() && !h.is_checking()) { showPiecesAvailability(true); std::vector avail; h.piece_availability(avail);