Fix mosh-server segfault on startup when run without arguments

This commit is contained in:
Keith Winstein
2014-01-04 03:08:57 -05:00
parent 96bf5af1b4
commit 578db45fbf
+2 -1
View File
@@ -205,7 +205,8 @@ public:
AddrInfo( const char *node, const char *service, AddrInfo( const char *node, const char *service,
const struct addrinfo *hints ) : const struct addrinfo *hints ) :
res( NULL ) { res( NULL ) {
int errcode = getaddrinfo( node, service, hints, &res ); int errcode = getaddrinfo( node ? node : "0",
service ? service : "0", hints, &res );
if ( errcode != 0 ) { if ( errcode != 0 ) {
throw NetworkException( std::string( "Bad IP address (" ) + node + "): " + gai_strerror( errcode ), 0 ); throw NetworkException( std::string( "Bad IP address (" ) + node + "): " + gai_strerror( errcode ), 0 );
} }