From a3533fe2da23df6d5f908d434fe6376129edca3c Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 11 Oct 2025 15:49:58 -0400 Subject: [PATCH] Prevent _alloc_command_line_arguments from crashing when defaulting to panic allocator. --- core/os/os_windows.odin | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/os/os_windows.odin b/core/os/os_windows.odin index f33aa1049..0e30f04fa 100644 --- a/core/os/os_windows.odin +++ b/core/os/os_windows.odin @@ -198,6 +198,10 @@ _alloc_command_line_arguments :: proc "contextless" () -> []string { context = runtime.default_context() arg_count: i32 arg_list_ptr := win32.CommandLineToArgvW(win32.GetCommandLineW(), &arg_count) + + // NOTE(Ed): Prevents panic, when none passed, there is only the win32 processs executable path + if context.allocator.procedure == runtime.panic_allocator_proc && arg_count == 1 do return {} + arg_list := make([]string, int(arg_count)) for _, i in arg_list { wc_str := (^win32.wstring)(uintptr(arg_list_ptr) + size_of(win32.wstring)*uintptr(i))^