Skip to content

Commit 225ea70

Browse files
author
meir
committed
Avoid passing NULL into from_raw_parts in case there are zero arguments on module load.
1 parent 02c1ab3 commit 225ea70

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/redismodule.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ pub fn decode_args(
9797
argv: *mut *mut raw::RedisModuleString,
9898
argc: c_int,
9999
) -> Vec<RedisString> {
100+
if argv.is_null() {
101+
return Vec::new();
102+
}
100103
unsafe { slice::from_raw_parts(argv, argc as usize) }
101104
.iter()
102105
.map(|&arg| RedisString::new(NonNull::new(ctx), arg))

0 commit comments

Comments
 (0)