]> source.dussan.org Git - rspamd.git/commitdiff
Fix trie text search.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 10 Jun 2011 14:54:26 +0000 (18:54 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 10 Jun 2011 14:54:26 +0000 (18:54 +0400)
src/lua/lua_config.c

index 4ca3b7e45343c4ccf07883182f0db9269cd3ccaa..b4db951ff720b2ec25e476384b83269629f06f31 100644 (file)
@@ -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;
                }