From 5e3f2049bde189841df2048baaf23100da173776 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Mon, 30 Mar 2026 17:45:49 +0000 Subject: [PATCH] bugfix(rts): Prevent null dereference in createActiveTeam --- Generals/Code/GameEngine/Source/Common/RTS/Team.cpp | 3 +++ GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp index c9016d189a..b19a3099cd 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -366,6 +366,9 @@ Team *TeamFactory::createTeam(const AsciiString& name) { Team *t = NULL; t = createInactiveTeam(name); + if (t == nullptr) { + return nullptr; + } t->setActive(); return t; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp index 30c8f07721..72bfcfe937 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Team.cpp @@ -366,6 +366,9 @@ Team *TeamFactory::createTeam(const AsciiString& name) { Team *t = NULL; t = createInactiveTeam(name); + if (t == nullptr) { + return nullptr; + } t->setActive(); return t; }