summaryrefslogtreecommitdiffstats
path: root/src/lua/lua_task.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-21 17:35:29 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-07-21 17:35:29 +0400
commitfd6c856b34c8fda53b7e45e3dcc17625206ed4fb (patch)
treeb4c8d1c62937038cb39bdcf7879110525fb05480 /src/lua/lua_task.c
parent875d1dd367eb433ae77a092148f483e9b9449a47 (diff)
downloadrspamd-fd6c856b34c8fda53b7e45e3dcc17625206ed4fb.tar.gz
rspamd-fd6c856b34c8fda53b7e45e3dcc17625206ed4fb.zip
Add workaround for clang under linux.
Fix problems found by static analyzing.
Diffstat (limited to 'src/lua/lua_task.c')
-rw-r--r--src/lua/lua_task.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index a6530160f..f3fdc3bad 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -166,7 +166,7 @@ lua_check_task (lua_State * L)
{
void *ud = luaL_checkudata (L, 1, "rspamd{task}");
luaL_argcheck (L, ud != NULL, 1, "'task' expected");
- return *((struct worker_task **)ud);
+ return ud ? *((struct worker_task **)ud) : NULL;
}
static struct mime_text_part *
@@ -174,7 +174,7 @@ lua_check_textpart (lua_State * L)
{
void *ud = luaL_checkudata (L, 1, "rspamd{textpart}");
luaL_argcheck (L, ud != NULL, 1, "'textpart' expected");
- return *((struct mime_text_part **)ud);
+ return ud ? *((struct mime_text_part **)ud) : NULL;
}
static struct rspamd_image *
@@ -182,7 +182,7 @@ lua_check_image (lua_State * L)
{
void *ud = luaL_checkudata (L, 1, "rspamd{image}");
luaL_argcheck (L, ud != NULL, 1, "'image' expected");
- return *((struct rspamd_image **)ud);
+ return ud ? *((struct rspamd_image **)ud) : NULL;
}
static struct uri *
@@ -190,7 +190,7 @@ lua_check_url (lua_State * L)
{
void *ud = luaL_checkudata (L, 1, "rspamd{url}");
luaL_argcheck (L, ud != NULL, 1, "'url' expected");
- return *((struct uri **)ud);
+ return ud ? *((struct uri **)ud) : NULL;
}
/*** Task interface ***/
@@ -1355,7 +1355,7 @@ lua_textpart_compare_distance (lua_State * L)
const GMimeContentType *ct;
luaL_argcheck (L, ud != NULL, 2, "'textpart' expected");
- other = *((struct mime_text_part **)ud);
+ other = ud ? *((struct mime_text_part **)ud) : NULL;
if (part->parent && part->parent == other->parent) {
parent = part->parent;