From 354d968a9468ba703ee1c5c98417174ab5f06333 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 20 Oct 2010 16:15:15 +0000 Subject: [PATCH] Fix possible crash on manual peer ban --- src/filterparserthread.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/filterparserthread.h b/src/filterparserthread.h index e146d5197..ee0107106 100644 --- a/src/filterparserthread.h +++ b/src/filterparserthread.h @@ -407,9 +407,12 @@ class FilterParserThread : public QThread { // First, import current filter ip_filter filter = s->get_ip_filter(); foreach(const QString &ip, IPs) { - qDebug("Manual ban of peer %s", ip.toLocal8Bit().data()); - address_v4 addr = address_v4::from_string(ip.toLocal8Bit().data()); - filter.add_rule(addr, addr, ip_filter::blocked); + qDebug("Manual ban of peer %s", ip.toLocal8Bit().constData()); + boost::system::error_code ec; + address_v4 addr = address_v4::from_string(ip.toLocal8Bit().constData(), ec); + Q_ASSERT(!ec); + if(!ec) + filter.add_rule(addr, addr, ip_filter::blocked); } s->set_ip_filter(filter); }