commit 8853005672374ceac8760548027a03fa284bf2d1 (tree) parent 348751462632234f2bee10f5faad3711eff89172 Author: alion02 <alojczek@gmail.com> Date: Tue, 4 Apr 2023 18:08:02 +0200 Fix crash on some Windows machines Diffstat:
| M | lib/std/process.zig | | | 3 | ++- |
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/std/process.zig b/lib/std/process.zig @@ -1164,7 +1164,8 @@ pub fn totalSystemMemory() TotalSystemMemoryError!usize { }, .windows => { var kilobytes: std.os.windows.ULONGLONG = undefined; - assert(std.os.windows.kernel32.GetPhysicallyInstalledSystemMemory(&kilobytes) == std.os.windows.TRUE); + if (std.os.windows.kernel32.GetPhysicallyInstalledSystemMemory(&kilobytes) != std.os.windows.TRUE) + return error.UnknownTotalSystemMemory; return kilobytes * 1024; }, else => return error.UnknownTotalSystemMemory,