From f8dc8ad4ad8b0577db51c8d47268272071176012 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 30 Oct 2016 15:48:26 +0800 Subject: [PATCH 1/2] Refactor --- src/gui/transferlistfilterswidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/transferlistfilterswidget.cpp b/src/gui/transferlistfilterswidget.cpp index eaa8e9d01..39f937d16 100644 --- a/src/gui/transferlistfilterswidget.cpp +++ b/src/gui/transferlistfilterswidget.cpp @@ -523,7 +523,7 @@ void TrackerFiltersList::addItem(const QString &tracker, const QString &hash) void TrackerFiltersList::removeItem(const QString &tracker, const QString &hash) { QString host = getHost(tracker); - QListWidgetItem *trackerItem = 0; + QListWidgetItem *trackerItem = nullptr; QStringList tmp = m_trackers.value(host); int row = 0; @@ -531,7 +531,7 @@ void TrackerFiltersList::removeItem(const QString &tracker, const QString &hash) return; tmp.removeAll(hash); - if (host != "") { + if (!host.isEmpty()) { // Remove from 'Error' and 'Warning' view trackerSuccess(hash, tracker); row = rowFromTracker(host); From aba625d5440a5795ab786a6a6452178f78a7fb6b Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 30 Oct 2016 16:09:50 +0800 Subject: [PATCH 2/2] Fix potential crash. Closes #5873. --- src/gui/transferlistfilterswidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/transferlistfilterswidget.cpp b/src/gui/transferlistfilterswidget.cpp index 39f937d16..83b41be6c 100644 --- a/src/gui/transferlistfilterswidget.cpp +++ b/src/gui/transferlistfilterswidget.cpp @@ -544,7 +544,8 @@ void TrackerFiltersList::removeItem(const QString &tracker, const QString &hash) updateGeometry(); return; } - trackerItem->setText(tr("%1 (%2)", "openbittorrent.com (10)").arg(host).arg(tmp.size())); + if (trackerItem != nullptr) + trackerItem->setText(tr("%1 (%2)", "openbittorrent.com (10)").arg(host).arg(tmp.size())); } else { row = 1;