HUD/mcl_death_messages: Fix crash when skeleton kills player using bow #202
No reviewers
Labels
No Label
blocker
bug
code quality
confirmed
critical
discussion
high priority
incompatibility
incomplete feature
invalid
low priority
missing feauture
needs testing
packet spam
performance
project
regression
translations
unconfirmed
in review
ready for review
No Milestone
No project
No Assignees
2 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Mineclonia/Mineclonia#202
Loading…
Reference in New Issue
No description provided.
Delete Branch "fix-skelly-crash-2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
TRACKING ISSUE: #196
Commit
5252952555
used string.gsub() tostrip 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.
Solution
This patchset uses cora's solution from #197 – only return the first value of string.gsub().
Details
This PR is basically #197 plus a few test cases. It is intended to replace #197 fully.
I have added six assertions to
mods/HUD/mcl_death_messages/init.lua
to make sure that all code paths through get_tool_name() behave as expected both now and in the future (after a possible refactoring or when the devs break the engine).Testing Steps
Verify bug
This is not necessary to do as part of a review, it has been done as part of verifying #196 already.
d70c05e92c
.Verify patch
609105e091
.11630091eb
to609105e091
Verify patch
609105e091
.