aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDedicatedTest/masterserver.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-25 04:52:51 +0000
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-12-25 04:52:51 +0000
commit81ae893c31fe462650b9793076df2467fd897181 (patch)
tree4c4c93f8d5882c5f2092924f626a67e080149a5d /NorthstarDedicatedTest/masterserver.cpp
parent8b6cf6a48586317e5629bddf5a32dc84b2663d63 (diff)
downloadNorthstarLauncher-81ae893c31fe462650b9793076df2467fd897181.tar.gz
NorthstarLauncher-81ae893c31fe462650b9793076df2467fd897181.zip
change how we handle invalid servers
Diffstat (limited to 'NorthstarDedicatedTest/masterserver.cpp')
-rw-r--r--NorthstarDedicatedTest/masterserver.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/NorthstarDedicatedTest/masterserver.cpp b/NorthstarDedicatedTest/masterserver.cpp
index 69a27454..fa918c5c 100644
--- a/NorthstarDedicatedTest/masterserver.cpp
+++ b/NorthstarDedicatedTest/masterserver.cpp
@@ -190,19 +190,14 @@ void MasterServerManager::RequestServerList()
|| !serverObj.HasMember("description") || !serverObj["description"].IsString()
|| !serverObj.HasMember("map") || !serverObj["map"].IsString()
|| !serverObj.HasMember("playlist") || !serverObj["playlist"].IsString()
+ || !serverObj.HasMember("playerCount") || !serverObj["playerCount"].IsNumber()
|| !serverObj.HasMember("maxPlayers") || !serverObj["maxPlayers"].IsNumber()
|| !serverObj.HasMember("hasPassword") || !serverObj["hasPassword"].IsBool()
|| !serverObj.HasMember("modInfo") || !serverObj["modInfo"].HasMember("Mods") || !serverObj["modInfo"]["Mods"].IsArray() )
{
spdlog::error("Failed reading masterserver response: malformed server object");
- goto REQUEST_END_CLEANUP;
- }
-
- int playerCount = 0;
- if (!serverObj.HasMember("playerCount") || !serverObj["playerCount"].IsNumber())
- playerCount = 0;
- else
- playerCount = serverObj["playerCount"].GetInt();
+ continue;
+ };
const char* id = serverObj["id"].GetString();
@@ -214,7 +209,7 @@ void MasterServerManager::RequestServerList()
// if server already exists, update info rather than adding to it
if (!strncmp((const char*)server.id, id, 32))
{
- server = RemoteServerInfo(id, serverObj["name"].GetString(), serverObj["description"].GetString(), serverObj["map"].GetString(), serverObj["playlist"].GetString(), playerCount, serverObj["maxPlayers"].GetInt(), serverObj["hasPassword"].IsTrue());
+ server = RemoteServerInfo(id, serverObj["name"].GetString(), serverObj["description"].GetString(), serverObj["map"].GetString(), serverObj["playlist"].GetString(), serverObj["playerCount"].GetInt(), serverObj["maxPlayers"].GetInt(), serverObj["hasPassword"].IsTrue());
newServer = &server;
createNewServerInfo = false;
break;