From 12223dfe90a25694f26e52847f834a983f3c3e5d Mon Sep 17 00:00:00 2001 From: Lucy Date: Sat, 19 Oct 2024 21:10:00 -0400 Subject: [PATCH] Fix a panic in `byond::parse_args` with debug assertions --- src/byond.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/byond.rs b/src/byond.rs index 8eb777ac..1e0e10c1 100644 --- a/src/byond.rs +++ b/src/byond.rs @@ -18,6 +18,9 @@ thread_local! { } pub unsafe fn parse_args<'a>(argc: c_int, argv: *const *const c_char) -> Vec> { + if argc == 0 || argv.is_null() { + return Vec::new(); + } unsafe { slice::from_raw_parts(argv, argc as usize) .iter()