From 295844a8ca95af94450c9da6ff6cde547df29caa Mon Sep 17 00:00:00 2001 From: Uladzislau Nikalayevich Date: Mon, 26 Aug 2024 16:57:02 +0300 Subject: [PATCH] Fix engineRequestModel crash caused by CResourceModelStreamer (#3675) * Fix crash * Fix refs count * Use reference --------- Co-authored-by: TEDERIs --- Client/mods/deathmatch/logic/CResourceModelStreamer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Client/mods/deathmatch/logic/CResourceModelStreamer.cpp b/Client/mods/deathmatch/logic/CResourceModelStreamer.cpp index 9c58219d8b..c6c2eb30d1 100644 --- a/Client/mods/deathmatch/logic/CResourceModelStreamer.cpp +++ b/Client/mods/deathmatch/logic/CResourceModelStreamer.cpp @@ -106,7 +106,11 @@ void CResourceModelStreamer::ReleaseAll() void CResourceModelStreamer::FullyReleaseModel(std::uint16_t modelId) { - std::uint16_t &refsCount = m_requestedModels[modelId]; + auto refs = m_requestedModels.find(modelId); + if (refs == m_requestedModels.end()) + return; + + std::uint16_t& refsCount = refs->second; if (refsCount > 0) {