From db56284ca4195840a207efcaa8ee44f6ccde7432 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Tue, 1 Aug 2023 19:32:40 +0300 Subject: [PATCH] Fix WindowsPlatform::LoadLibrary to not modify the string parameter --- Source/Engine/Platform/Windows/WindowsPlatform.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Source/Engine/Platform/Windows/WindowsPlatform.cpp b/Source/Engine/Platform/Windows/WindowsPlatform.cpp index 4d43272d1..970ccfa10 100644 --- a/Source/Engine/Platform/Windows/WindowsPlatform.cpp +++ b/Source/Engine/Platform/Windows/WindowsPlatform.cpp @@ -1191,11 +1191,8 @@ void* WindowsPlatform::LoadLibrary(const Char* filename) folder = StringView::Empty; if (folder.HasChars()) { - Char& end = ((Char*)folder.Get())[folder.Length()]; - const Char c = end; - end = 0; - SetDllDirectoryW(*folder); - end = c; + String folderNullTerminated(folder); + SetDllDirectoryW(folderNullTerminated.Get()); } // Avoiding windows dialog boxes if missing