From 4a5482087e16835eb7b2cf49ea0089f6f689442b Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 27 Feb 2019 03:53:45 +0100 Subject: [PATCH] Prevent crash when entering wrong password --- SourceX/dvlnet/tcp_client.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SourceX/dvlnet/tcp_client.cpp b/SourceX/dvlnet/tcp_client.cpp index bfc32c557..8b76a0beb 100644 --- a/SourceX/dvlnet/tcp_client.cpp +++ b/SourceX/dvlnet/tcp_client.cpp @@ -39,7 +39,11 @@ int tcp_client::join(std::string addrstr, std::string passwd) game_init_info); send(*pkt); for (auto i = 0; i < no_sleep; ++i) { - poll(); + try { + poll(); + } catch (const std::runtime_error e) { + return -1; + } if (plr_self != PLR_BROADCAST) break; // join successful std::this_thread::sleep_for(std::chrono::milliseconds(ms_sleep));