From: Vsevolod Stakhov Date: Tue, 8 Feb 2011 17:14:03 +0000 (+0300) Subject: Fix trie in lua plugins. X-Git-Tag: 0.3.7~54 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cec24a9efaa5a4dacece6c1ed5a44ac483d83a55;p=rspamd.git Fix trie in lua plugins. --- 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 */