aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_task.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-07-12 17:27:13 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-07-12 17:27:13 +0100
commit5ccaf0c78a1b8ebcb75956941dcd648cf5614fe9 (patch)
tree846737c9d30a0a199dfe32f5963ea1e2f5330f3d /src/lua/lua_task.c
parent8e2facd1aaeaca370750185ba4b627e76140c02d (diff)
downloadrspamd-mime-rework.tar.gz
rspamd-mime-rework.zip
[Minor] Fix plugins to work with empty tasksmime-rework
Diffstat (limited to 'src/lua/lua_task.c')
-rw-r--r--src/lua/lua_task.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index d77d5b01d..068459922 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -5416,18 +5416,23 @@ lua_task_get_newlines_type (lua_State *L)
LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
- if (task && task->message) {
- switch (MESSAGE_FIELD (task, nlines_type)) {
- case RSPAMD_TASK_NEWLINES_CR:
- lua_pushstring (L, "cr");
- break;
- case RSPAMD_TASK_NEWLINES_LF:
- lua_pushstring (L, "lf");
- break;
- case RSPAMD_TASK_NEWLINES_CRLF:
- default:
+ if (task) {
+ if (task->message) {
+ switch (MESSAGE_FIELD (task, nlines_type)) {
+ case RSPAMD_TASK_NEWLINES_CR:
+ lua_pushstring (L, "cr");
+ break;
+ case RSPAMD_TASK_NEWLINES_LF:
+ lua_pushstring (L, "lf");
+ break;
+ case RSPAMD_TASK_NEWLINES_CRLF:
+ default:
+ lua_pushstring (L, "crlf");
+ break;
+ }
+ }
+ else {
lua_pushstring (L, "crlf");
- break;
}
}
else {