From: Vsevolod Stakhov Date: Fri, 10 Jun 2011 14:54:26 +0000 (+0400) Subject: Fix trie text search. X-Git-Tag: 0.3.14~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cef2f44866f6311411929c09c95f3af906ba5bc3;p=rspamd.git Fix trie text search. --- diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index 4ca3b7e45..b4db951ff 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -721,6 +721,7 @@ lua_trie_search_text (lua_State *L) const gchar *text, *pos; gint id, i = 1; gsize len; + gboolean found = FALSE; if (trie) { text = luaL_checkstring (L, 2); @@ -733,6 +734,12 @@ lua_trie_search_text (lua_State *L) lua_pushinteger (L, id); lua_settable (L, -3); i ++; + found = TRUE; + break; + } + + if (!found) { + lua_pushnil (L); } return 1; }