From e7c290dd5e39760f9978d8d83ed07165b4b7ab36 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Tue, 2 Aug 2016 03:45:28 +0200 Subject: [PATCH] bugfix --- tabs/search/core.lua | 9 ++++++++- util/filter.lua | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tabs/search/core.lua b/tabs/search/core.lua index 445ae26..3e380cd 100644 --- a/tabs/search/core.lua +++ b/tabs/search/core.lua @@ -728,7 +728,7 @@ function private.initialize_filter_dropdown() local function on_click() UIDropDownMenu_SetSelectedValue(m.filter_dropdown, this.value) m.filter_button:SetText(this.value) - if Aux.safe(Aux.filter.filters[this.value]).input_type/'' == '' then + if Aux.safe(Aux.filter.filters[this.value]).input_type/'' == '' and this.value ~= 'and' and this.value ~= 'or' then m.filter_input:Hide() else local _, _, suggestions = Aux.filter.parse_query_string(UIDropDownMenu_GetSelectedValue(m.filter_dropdown)..'/') @@ -861,6 +861,13 @@ function private.add_post_filter() local name = UIDropDownMenu_GetSelectedValue(m.filter_dropdown) if name then local filter = name + if not Aux.filter.filters[name] and filter == 'and' or filter == 'or' then + if not tonumber(m.filter_input:GetText()) and m.filter_input:GetText() ~= '*' then + Aux.log('Invalid operator suffix') + return + end + filter = filter..m.filter_input:GetText() + end if Aux.filter.filters[name] and Aux.filter.filters[name].input_type ~= '' then filter = filter..'/'..m.filter_input:GetText() end diff --git a/util/filter.lua b/util/filter.lua index 85657d4..fcb1800 100644 --- a/util/filter.lua +++ b/util/filter.lua @@ -559,15 +559,17 @@ function public.indented_post_query_string(components) suffix = component[3] end str = str..'|cffffff00'..component[2]..suffix..'|r' - tinsert(stack, component[3]) + tinsert(stack, component[3] or '*') elseif component[1] == 'filter' then str = str..'|cffffff00'..component[2]..'|r' if component[3] then str = str..': '..'|cffff9218'..component[3]..'|r' end local top = tremove(stack) - if top and top > 1 then + if tonumber(top) and top > 1 then tinsert(stack, top - 1) + elseif top == '*' then + tinsert(stack, top) end end end