Skip to content

Commit 961b04c

Browse files
committed
Avoid calling decode args if there are no args given when loading module
1 parent 72d13f5 commit 961b04c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/macros.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ macro_rules! redis_module {
155155
) } == raw::Status::Err as c_int { return raw::Status::Err as c_int; }
156156

157157
let context = $crate::Context::new(ctx);
158-
let args = $crate::decode_args(ctx, argv, argc);
158+
let args = if argc == 0 {
159+
Vec::new()
160+
} else {
161+
$crate::decode_args(ctx, argv, argc)
162+
};
159163

160164
$(
161165
if $init_func(&context, &args) == $crate::Status::Err {

0 commit comments

Comments
 (0)