Skip to content

Commit 3cedd2d

Browse files
Fahnenfluchtigewillmafh
authored andcommitted
optimize: checked r before using it.
1 parent c4c4328 commit 3cedd2d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/ngx_stream_lua_util.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,10 @@ ngx_stream_lua_req_socket(lua_State *L)
19351935

19361936
r = ngx_stream_lua_get_req(L);
19371937

1938+
if (r == NULL) {
1939+
return luaL_error(L, "no request found");
1940+
}
1941+
19381942
ctx = ngx_stream_lua_get_module_ctx(r, ngx_stream_lua_module);
19391943
if (ctx == NULL) {
19401944
return luaL_error(L, "no ctx found");

0 commit comments

Comments
 (0)