[Crash] Resolve crash due to uninitialized pointer. #3271
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where
const ItemData* m_item
could be left in an uninitialized state, which would cause a crash when we attempt to dereference it, as seen in the below crash:http://spire.akkadius.com/dev/release/22.9.1-dev?id=3061
This would also fix the following crash as well:
https://discord.com/channels/212663220849213441/1093971541382934630/1093971541382934630
I use Non Static Data Members Initialization (also called In-Class Member Initialization) to initialize the values for both objects, this ensures any value that doesn't get assigned have a valid assignment (0, "" or nullptr) depending on type.