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

Fix a crash when burning things #36471

Merged
merged 2 commits into from
Dec 26, 2019

Conversation

hexagonrecursion
Copy link
Contributor

Summary

SUMMARY: Bugfixes "Fixes a crash when burning things"

Prpose of change

Fixes #36441 - The game crashes when burning something when one of the materials it is made out of does not define burn_data.

Describe the solution

  1. _burn_data now always contains at least one element
  2. The vector index is clamped into range

Describe alternatives you've considered

Testing

Additional context

Perhaps this is a purist in me talking, but a JSON array can be empty but _burn_data must not be empty because material_type::burn_data() returns a reference to one of its elements.
@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` labels Dec 26, 2019
@ZhilkinSerg ZhilkinSerg merged commit 1f92726 into CleverRaven:master Dec 26, 2019
@hexagonrecursion hexagonrecursion deleted the patch-3 branch December 26, 2019 20:15
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`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read past the end of buffer in item::simulate_burn for materials without burn_data
2 participants