summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swiften/Network/HostAddressPort.cpp7
1 files changed, 6 insertions, 1 deletions
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;
}