Skip to content

Commit 8853005

Browse files
alion02kubkon
authored andcommitted
Fix crash on some Windows machines
1 parent 3487514 commit 8853005

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/std/process.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,8 @@ pub fn totalSystemMemory() TotalSystemMemoryError!usize {
11641164
},
11651165
.windows => {
11661166
var kilobytes: std.os.windows.ULONGLONG = undefined;
1167-
assert(std.os.windows.kernel32.GetPhysicallyInstalledSystemMemory(&kilobytes) == std.os.windows.TRUE);
1167+
if (std.os.windows.kernel32.GetPhysicallyInstalledSystemMemory(&kilobytes) != std.os.windows.TRUE)
1168+
return error.UnknownTotalSystemMemory;
11681169
return kilobytes * 1024;
11691170
},
11701171
else => return error.UnknownTotalSystemMemory,

0 commit comments

Comments
 (0)