diff --git a/src/tcp_address.cpp b/src/tcp_address.cpp index 46a2e36d..7db3d248 100644 --- a/src/tcp_address.cpp +++ b/src/tcp_address.cpp @@ -392,10 +392,10 @@ int zmq::tcp_address_t::resolve (const char *name_, bool local_, bool ipv4only_) uint16_t port; // Allow 0 specifically, to detect invalid port error in atoi if not - if (port_str[0] == '*' || port_str[0] == '0') { + if (port_str == "*" || port_str == "0") // Resolve wildcard to 0 to allow autoselection of port port = 0; - } else { + else { // Parse the port number (0 is not a valid port). port = (uint16_t) atoi (port_str.c_str()); if (port == 0) {