From deada93460261d83e8e3595f35a6ace42b25734f Mon Sep 17 00:00:00 2001 From: Steven Siloti Date: Sat, 13 Oct 2018 10:13:00 -0700 Subject: [PATCH] client_test: fix assert when adding a magnet link --- examples/torrent_view.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/torrent_view.cpp b/examples/torrent_view.cpp index 6dff7ab18..09ceeb7f4 100644 --- a/examples/torrent_view.cpp +++ b/examples/torrent_view.cpp @@ -388,7 +388,7 @@ void torrent_view::print_torrent(lt::torrent_status const& s, bool selected) progress_bar_color = col_green; auto ti = s.torrent_file.lock(); - int const total_pieces = ti ? ti->num_pieces() : 0; + int const total_pieces = ti && ti->is_valid() ? ti->num_pieces() : 0; color_code piece_color = total_pieces == s.num_pieces ? col_green : col_yellow; pos += std::snprintf(str + pos, sizeof(str) - pos, "%s%-3s %-50s %s%s %s/%s %s (%s) "