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

Check emptiness of backlog and str_values to fix tree chopping fetch crash #36705

Merged
merged 1 commit into from Jan 5, 2020
Merged

Conversation

ghost
Copy link

@ghost ghost commented Jan 4, 2020

Summary

SUMMARY: Bugfixes "Check emptiness of backlog and str_values to fix tree chopping fetch crash"

Purpose of change

Fixes #36544

Describe the solution

Check emptiness before trying to access backlog activity or its str values, return empty requirements map if these thigns are empty, activity stops.

Describe alternatives you've considered

N/A

Testing

Stops the crash in the linked issue.

Additional context

I couldnt get the bug to trigger agian by restarting the activity with any of the NPCs there, I cannot think of how the activity str_value had an empty string.
First of all - the NPCs are all outside the range of the usual loot zone search radius, the OP of th eissue said two of the NPCs refused the task and failed correctly.
ONe of them zoomed off to fetch the axe, but didnt store the axe requirement id, which seems impossible from the code - it only applies the fetch activity once its added a string to its string values.

WHenever I tried to get them to do it agian, they alll refused as there wasnt a nearby axe.

But this at least stops it crashing if such a thing occurs again.

@ZhilkinSerg ZhilkinSerg added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` NPC / Factions NPCs, AI, Speech, Factions, Ownership labels Jan 4, 2020
@kevingranade kevingranade merged commit 921a9f4 into CleverRaven:master Jan 5, 2020
fengjixuchui added a commit to fengjixuchui/Cataclysm-DDA that referenced this pull request Jan 5, 2020
@ghost ghost deleted the chop_tree_fix_crash branch January 17, 2020 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash to desktop when NPC tries chopping trees
2 participants