diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-02-08 20:14:03 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-02-08 20:14:03 +0300 |
commit | cec24a9efaa5a4dacece6c1ed5a44ac483d83a55 (patch) | |
tree | 6f8e9907ad69bd21c08c23f61ff9844ca74f0498 | |
parent | 4712b0316d24bcf2824b4ef3004d750315c56626 (diff) | |
download | rspamd-cec24a9efaa5a4dacece6c1ed5a44ac483d83a55.tar.gz rspamd-cec24a9efaa5a4dacece6c1ed5a44ac483d83a55.zip |
Fix trie in lua plugins.
-rw-r--r-- | src/lua/lua_config.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index 8259ae9a4..62ea849f5 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -691,7 +691,8 @@ lua_trie_search_task (lua_State *L) GList *cur; const gchar *pos, *end; gint id, i = 1; - void *ud; + void *ud; + gboolean found = FALSE; if (trie) { ud = luaL_checkudata (L, 2, "rspamd{task}"); @@ -710,15 +711,22 @@ lua_trie_search_task (lua_State *L) lua_pushinteger (L, id); lua_settable (L, -3); i ++; + found = TRUE; + break; } } cur = g_list_next (cur); } + if (!found) { + lua_pushnil (L); + } return 1; } } - lua_pushnil (L); + if (!found) { + lua_pushnil (L); + } return 1; } /* Init functions */ |