Fix crash when skeleton kills player using bow

Commit 5252952555 used string.gsub() to
strip newlines from tools in death messages. The second return value of
string.gsub() (the number of substitutions) was erroneously returned too
by get_tool_name(). This bug caused a crash whenever a skeleton killed a
player using its bow.
This commit is contained in:
cora 2021-12-05 03:06:33 +01:00 committed by Nils Dagsson Moskopp
parent d70c05e92c
commit f9e3c4fd6d
No known key found for this signature in database
GPG key ID: A3BC671C35191080

View file

@ -7,7 +7,8 @@ local function get_tool_name(item)
local def = item:get_definition()
name=def._tt_original_description or def.description
end
return name:gsub("[\r\n]"," ")
local sanitized_name, substitution_count = name:gsub("[\r\n]"," ")
return sanitized_name
end
mcl_death_messages = {}