fix(gears: matcher: default_matcher): handle sidecase of string.match-ing the empty string ('')
This commit is contained in:
parent
87e7b84ff5
commit
90aacbc5b5
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue