From: Vsevolod Stakhov Date: Tue, 22 Jan 2019 16:32:52 +0000 (+0000) Subject: [Minor] Add some fail safety X-Git-Tag: 1.9.0~272 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=295b806e92a75d06eae3b02a633a647bf28b8bec;p=rspamd.git [Minor] Add some fail safety --- diff --git a/src/plugins/dkim_check.c b/src/plugins/dkim_check.c index 83272a585..a203edc3d 100644 --- a/src/plugins/dkim_check.c +++ b/src/plugins/dkim_check.c @@ -1606,10 +1606,33 @@ dkim_module_lua_push_verify_result (struct rspamd_dkim_lua_verify_cbdata *cbd, lua_pushstring (cbd->L, error_str); if (cbd->ctx) { - lua_pushstring (cbd->L, res->domain); - lua_pushstring (cbd->L, res->selector); - lua_pushstring (cbd->L, res->short_b); - lua_pushstring (cbd->L, res->fail_reason); + if (res->domain) { + lua_pushstring (cbd->L, res->domain); + } + else { + lua_pushnil (cbd->L); + } + + if (res->selector) { + lua_pushstring (cbd->L, res->selector); + } + else { + lua_pushnil (cbd->L); + } + + if (res->short_b) { + lua_pushstring (cbd->L, res->short_b); + } + else { + lua_pushnil (cbd->L); + } + + if (res->fail_reason) { + lua_pushstring (cbd->L, res->fail_reason); + } + else { + lua_pushnil (cbd->L); + } } else { lua_pushnil (cbd->L);