From 0bb8c124cae1b42aa6c242c9bc30ca24fa4f1972 Mon Sep 17 00:00:00 2001 From: "Meir Shpilraien (Spielrein)" Date: Sun, 22 Oct 2023 15:37:21 +0300 Subject: [PATCH] Avoid passing NULL into from_raw_parts in case there are zero arguments on module load. (#371) --- src/redismodule.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/redismodule.rs b/src/redismodule.rs index 2584aed5..46ed3ec1 100644 --- a/src/redismodule.rs +++ b/src/redismodule.rs @@ -101,6 +101,9 @@ pub fn decode_args( argv: *mut *mut raw::RedisModuleString, argc: c_int, ) -> Vec { + if argv.is_null() { + return Vec::new(); + } unsafe { slice::from_raw_parts(argv, argc as usize) } .iter() .map(|&arg| RedisString::new(NonNull::new(ctx), arg))