From 34fc7407a2d79988b59bdcb4202bca914fd6fe8f Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 13 Jan 2013 12:53:34 +0200 Subject: [PATCH] Fix possible crash in loadPeers() (closes #222) --- src/properties/peerlistwidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/properties/peerlistwidget.cpp b/src/properties/peerlistwidget.cpp index ead9fed61..290cbd993 100644 --- a/src/properties/peerlistwidget.cpp +++ b/src/properties/peerlistwidget.cpp @@ -316,8 +316,10 @@ void PeerListWidget::loadPeers(const QTorrentHandle &h, bool force_hostname_reso std::vector::const_iterator itrend = peers.end(); for ( ; itr != itrend; ++itr) { peer_info peer = *itr; - QString peer_ip = misc::toQString(peer.ip.address().to_string(ec)); - if (ec) continue; + std::string ip_str = peer.ip.address().to_string(ec); + if (ec) + continue; + QString peer_ip = misc::toQString(ip_str); if (m_peerItems.contains(peer_ip)) { // Update existing peer updatePeer(peer_ip, peer);