From 3faf9eea45cbf96e2236ada2f89cd20ba99ff448 Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Wed, 15 Jan 2025 15:50:30 -0600 Subject: [PATCH] fix invalid players from showing up in api response --- dChatServer/JSONUtils.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dChatServer/JSONUtils.cpp b/dChatServer/JSONUtils.cpp index b3dfc4e7..1c32409c 100644 --- a/dChatServer/JSONUtils.cpp +++ b/dChatServer/JSONUtils.cpp @@ -17,7 +17,11 @@ void to_json(json& data, const PlayerData& playerData) { } void to_json(json& data, const PlayerContainer& playerContainer) { - data = playerContainer.GetAllPlayers(); + data = json::array(); + for(auto& playerData : playerContainer.GetAllPlayers()) { + if (playerData.first == LWOOBJID_EMPTY) continue; + data.push_back(playerData.second); + } } void to_json(json& data, const TeamContainer& teamContainer) {