diff options
-rw-r--r-- | client_ws.hpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/client_ws.hpp b/client_ws.hpp index a892149..b17ff5e 100644 --- a/client_ws.hpp +++ b/client_ws.hpp @@ -367,7 +367,12 @@ namespace SimpleWeb { } else { parsed_host_port.first = host_port.substr(0, host_end); - parsed_host_port.second = static_cast<unsigned short>(stoul(host_port.substr(host_end + 1))); + try { + parsed_host_port.second = static_cast<unsigned short>(stoul(host_port.substr(host_end + 1))); + } + catch(...) { + parsed_host_port.second = default_port; + } } return parsed_host_port; } |