Fix crash when searching for "["

This commit is contained in:
Wuzzy 2024-11-02 12:06:37 +01:00
parent b03c1451ca
commit 277773b32a

View File

@ -127,7 +127,7 @@ local collect_items = function(filter, lang_code)
-- First, try to match original description
if desc ~= "" then
local ldesc = string.lower(desc)
matches = string.match(ldesc, filter) ~= nil
matches = string.find(ldesc, filter, 1, true) ~= nil
-- Second, try to match translated description
if not matches then
local tdesc = minetest.get_translated_string(lang_code, desc)
@ -142,14 +142,14 @@ local collect_items = function(filter, lang_code)
if sdesc ~= "" then
sdesc = minetest.get_translated_string(lang_code, sdesc)
sdesc = string.lower(sdesc)
matches = string.match(sdesc, filter) ~= nil
matches = string.find(sdesc, filter, 1, true) ~= nil
end
end
end
-- Fourth, try to match itemstring
if not matches then
matches = string.match(itemstring, filter) ~= nil
matches = string.find(itemstring, filter, 1, true) ~= nil
end
-- If item was matched, add to item list