From 56f982fa7f6da6134cff0d81040ebdf39b72ea2d Mon Sep 17 00:00:00 2001 From: PeterN Date: Sun, 11 Apr 2021 13:07:08 +0100 Subject: [PATCH] Fix #9015: Don't set free space value if not requested. (#9016) --- src/os/windows/win32.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index 073f70b98c..ddcfd4866c 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -247,7 +247,7 @@ bool FiosGetDiskFreeSpace(const char *path, uint64 *tot) ULARGE_INTEGER bytes_free; bool retval = GetDiskFreeSpaceEx(OTTD2FS(path).c_str(), &bytes_free, nullptr, nullptr); - if (retval) *tot = bytes_free.QuadPart; + if (retval && tot != nullptr) *tot = bytes_free.QuadPart; SetErrorMode(sem); // reset previous setting return retval;