From 5939c00fe16c28427a085a339f6b598bb9bef6ec Mon Sep 17 00:00:00 2001 From: PixieCore <41352111+PixieCore@users.noreply.github.com> Date: Mon, 28 Mar 2022 00:59:39 +0200 Subject: [PATCH] Avoid potential crash for unloading rpaks. --- r5dev/engine/host_state.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r5dev/engine/host_state.cpp b/r5dev/engine/host_state.cpp index 90f14a84..3c3f6a27 100644 --- a/r5dev/engine/host_state.cpp +++ b/r5dev/engine/host_state.cpp @@ -91,7 +91,7 @@ FORCEINLINE void CHostState::FrameUpdate(void* rcx, void* rdx, float time) case HostStates_t::HS_CHANGE_LEVEL_MP: { g_pHostState->State_ChangeLevelMP(); - g_pHostState->UnloadPakFile(); // Unload our loaded rpaks. Calling this before the actual level change happens kills the game. + g_pHostState->UnloadPakFile(); break; } case HostStates_t::HS_RUN: @@ -103,9 +103,9 @@ FORCEINLINE void CHostState::FrameUpdate(void* rcx, void* rdx, float time) { DevMsg(eDLL_T::ENGINE, "%s - Shutdown host game\n", "CHostState::FrameUpdate"); - g_pHostState->UnloadPakFile(); g_bLevelResourceInitialized = false; Host_Game_ShutdownFn(g_pHostState); + g_pHostState->UnloadPakFile(); break; } case HostStates_t::HS_RESTART: