fix(gears: matcher: default_matcher): handle sidecase of string.match-ing the empty string ('')

This commit is contained in:
actionless 2020-04-21 19:51:11 +02:00
parent 87e7b84ff5
commit 90aacbc5b5
1 changed files with 7 additions and 1 deletions

View File

@ -79,7 +79,13 @@ local matcher = {}
-- @see remove_matching_source
local function default_matcher(a, b)
return a == b or (type(a) == "string" and a:match(b))
local result = a == b
if result then return result end
if type(a) == "string" and type(b) == "string" then
result = a:match(b)
if result == '' then result = nil end
end
return result
end
local function greater_matcher(a, b)