From 049a95e4e1a4e981cd7a9f9f591f04ce94178548 Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Mon, 27 Feb 2017 14:52:04 +0000
Subject: Handle boost::bad_lexical_cast exception in
 HostAddressPort::toString()

Test-Information:

Builds and unit tests pass on macOS 10.12.3 with Qt 5.7.1.

Change-Id: I258ea7a70a025bc0ebf61eea7acd636e90fc8b1e

diff --git a/Swiften/Network/HostAddressPort.cpp b/Swiften/Network/HostAddressPort.cpp
index a73b2ad..76c276e 100644
--- a/Swiften/Network/HostAddressPort.cpp
+++ b/Swiften/Network/HostAddressPort.cpp
@@ -19,5 +19,10 @@ HostAddressPort::HostAddressPort(const boost::asio::ip::tcp::endpoint& endpoint)
 }
 
 std::string HostAddressPort::toString() const {
-    return getAddress().toString() + ":" + boost::lexical_cast<std::string>(getPort());
+    std::string portAsString;
+    try {
+        portAsString = boost::lexical_cast<std::string>(getPort());
+    } catch (boost::bad_lexical_cast&) {
+    }
+    return getAddress().toString() + ":" + portAsString;
 }
-- 
cgit v0.10.2-6-g49f6