Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent crash for malformed mining activity. #46020

Merged
merged 1 commit into from
Dec 13, 2020

Conversation

kevingranade
Copy link
Member

Summary

SUMMARY: None

Purpose of change

Fixes #42900
It turns out that going forward this was already fixed by #44841, but these changes by andr8i prevent a crash as well.

Describe the solution

Check for presence of a tool target before dereferencing it.

Describe alternatives you've considered

This isn't SUUUPER necessary, because a previous PR fixed the code that sets it, but this is nice and robust, and tells us whent wrong when it goes wrong.

Testing

Spawn and befriend a NPC.
Spawn a pickaxe.
Visit a basement.
Set a mining zone ( Y -> add zone -> mining zone ) on the wall.
Give the NPC the pickaxe.
C hat at the NPC, ask them what they're (d)oing, (h)arangue NPC about their activity (cancel it and start over if necessary), (e)ncourage the NPC to start mining.
Wait for the NPC to finish mining out a tile.
No crash.

@anothersimulacrum anothersimulacrum added the [C++] Changes (can be) made in C++. Previously named `Code` label Dec 13, 2020
@ZhilkinSerg ZhilkinSerg merged commit 95570d8 into CleverRaven:master Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when NPC is mining.
4 participants