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