diff --git a/src/connection.c b/src/connection.c index 3e2021fb5..a59463220 100644 --- a/src/connection.c +++ b/src/connection.c @@ -427,7 +427,7 @@ int connGetState(connection *conn) { * For sockets, we always return "fd=" to maintain compatibility. */ const char *connGetInfo(connection *conn, char *buf, size_t buf_len) { - snprintf(buf, buf_len-1, "fd=%i", conn->fd); + snprintf(buf, buf_len-1, "fd=%i", conn == NULL ? -1 : conn->fd); return buf; } diff --git a/tests/unit/moduleapi/misc.tcl b/tests/unit/moduleapi/misc.tcl index b5cd6100c..a6a7a78f9 100644 --- a/tests/unit/moduleapi/misc.tcl +++ b/tests/unit/moduleapi/misc.tcl @@ -111,4 +111,8 @@ start_server {tags {"modules"}} { r test.log_tsctx "info" "Test message" verify_log_message 0 "* Test message*" 0 } + + test {test RM_Call CLIENT INFO} { + assert_match "*fd=-1*" [r test.call_generic client info] + } }