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 alonre24 committed Jan 14, 2025
1 parent 961b04c commit e4bea89
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 @@ -80,6 +80,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(ctx, arg))
Expand Down

0 comments on commit e4bea89

Please sign in to comment.