Fix two occasional runtime errors (#191)

This commit is contained in:
Oversword 2021-12-25 16:31:18 +00:00 committed by GitHub
parent 64b0248c77
commit d6688872c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

@ -332,7 +332,9 @@ function ui.apply_filter(player, filter, search_dir)
return true
end
else
local lang = minetest.get_player_information(player_name).lang_code
local player_info = minetest.get_player_information(player_name)
local lang = player_info and player_info.lang_code or ""
ffilter = function(name, def)
local lname = string.lower(name)
local ldesc = string.lower(def.description)

@ -499,6 +499,14 @@ local function craftguide_craft(player, formname, fields)
local alternate = ui.alternate[player_name]
local craft = crafts[alternate]
if not craft.width then
if not craft.output then
minetest.log("warning", "[unified_inventory] Craft has no output.")
else
minetest.log("warning", ("[unified_inventory] Craft for '%s' has no width."):format(craft.output))
end
return
end
if craft.width > 3 then return end
ui.craftguide_match_craft(player, "main", "craft", craft, amount)