From 77860c003628420f032c524653cc61fbcfc05ad0 Mon Sep 17 00:00:00 2001 From: Roman Arutyunyan Date: Sun, 13 Jan 2013 19:22:49 +0400 Subject: [PATCH] fixed access log command variable --- ngx_rtmp_log_module.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ngx_rtmp_log_module.c b/ngx_rtmp_log_module.c index 2d54473..1e0f4c1 100644 --- a/ngx_rtmp_log_module.c +++ b/ngx_rtmp_log_module.c @@ -220,6 +220,7 @@ ngx_rtmp_log_var_command_getdata(ngx_rtmp_session_t *s, u_char *buf, { ngx_rtmp_log_ctx_t *ctx; ngx_str_t *cmd; + ngx_uint_t n; static ngx_str_t commands[] = { ngx_string("NONE"), @@ -229,11 +230,10 @@ ngx_rtmp_log_var_command_getdata(ngx_rtmp_session_t *s, u_char *buf, }; ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_log_module); - if (ctx == NULL) { - return buf; - } - cmd = &commands[ctx->play + ctx->publish * 2]; + n = ctx ? (ctx->play + ctx->publish * 2) : 0; + + cmd = &commands[n]; return ngx_cpymem(buf, cmd->data, cmd->len); }