forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent segfault when refitting item in spillable container
Prevents segfault from accessing an invalidated `item_location` when refitting an item that was stored inside a spillable container. The previous segfault could be reproduced by having an inventory like: ``` backpack > aluminum can > work t-shirt (poor fit) ``` And then using a tailor's kit to refit the t-shirt caused a segfault. Part of refitting will invalidate items inside the aluminum can, which is a spillable container, and dereferencing the tshirt wil segfault. This change instead makes sure that we do not use `fix_location` after we have called `repair_item_actor::repair`. It also adds a unit test that reproduced the previous segfault (but works on this branch).
- Loading branch information
Showing
2 changed files
with
87 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters