Skip to content

Commit

Permalink
Avoid passing NULL into from_raw_parts in case there are zero argumen…
Browse files Browse the repository at this point in the history
…ts on module load. (#371)

(cherry picked from commit 0bb8c12)
  • Loading branch information
MeirShpilraien authored and oshadmi committed Oct 22, 2023
1 parent 583fac0 commit 46922b1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/redismodule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ pub fn decode_args(
argv: *mut *mut raw::RedisModuleString,
argc: c_int,
) -> Vec<RedisString> {
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))
Expand Down

0 comments on commit 46922b1

Please sign in to comment.