Skip to content

Commit 0bb8c12

Browse files
author
Meir Shpilraien (Spielrein)
authored
Avoid passing NULL into from_raw_parts in case there are zero arguments on module load. (#371)
1 parent 2b476af commit 0bb8c12

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
@@ -101,6 +101,9 @@ pub fn decode_args(
101101
argv: *mut *mut raw::RedisModuleString,
102102
argc: c_int,
103103
) -> Vec<RedisString> {
104+
if argv.is_null() {
105+
return Vec::new();
106+
}
104107
unsafe { slice::from_raw_parts(argv, argc as usize) }
105108
.iter()
106109
.map(|&arg| RedisString::new(NonNull::new(ctx), arg))

0 commit comments

Comments
 (0)