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: Repair Item activity occasionally encountering a bad pointer when initiated from vehicle/grid #3611

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

KheirFerrum
Copy link
Collaborator

@KheirFerrum KheirFerrum commented Nov 10, 2023

Summary

SUMMARY: Bugfixes "Fix Repair Item activity occasionally encountering a bad pointer when initiated from vehicle/grid"

Purpose of change

Repair Item activity was crashing because it tries to construct an item from an invalid pointer when the activity is initiated from vehicle/grid, as the fake_item used to initiate the activity stops existing after initiating the activity. Prior to item identity this wasn't an issue as item location can lead to invalid locations so long as you don't actually use it.

Describe the solution

Cleaned up repair_item_finish a bit, restructuring it so it doesn't even try to call the pointer unless it's confirmed it should have a valid one.

Describe alternatives you've considered

Testing

This is... difficult, as the bug was random to begin with.

  • Spawn a grid with 2 large storage batteries and a welding rig. Use solar panels (2/3 advanced solar panels will probably be fine) to top off the storage batteries. Wait a few hours to fill the batteries.
  • Spawn 10 rifle scopes and 2000 aluminum ingots.
  • Set skill to 10, activate the grid welder and repeat until reinforced on a single rifle scope.
  • If it doesn't crash before the storage batteries deplete (or you run out of aluminum), then it's probably fine?
  • Repeat with a welding cart with extra storage batteries (or a minireactor.

Additional context

Spaghetti and shiny new features colliding is such great fun.

Checklist

@github-actions github-actions bot added the src changes related to source code. label Nov 10, 2023
Rearranges stuff due to item identity breaking if the pointer is invalid instead of just null.
@scarf005 scarf005 changed the title Fix Repair Item activity occasionally encountering a bad pointer when initiated from vehicle/grid fix: Repair Item activity occasionally encountering a bad pointer when initiated from vehicle/grid Nov 10, 2023
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grid.mp4
vehicle.mp4

followed both tests and they worked without errors.
for some reason it lags a lot during and after welding, strange...

@scarf005 scarf005 added this pull request to the merge queue Nov 10, 2023
Merged via the queue into cataclysmbnteam:upload with commit 10804a4 Nov 10, 2023
14 of 17 checks passed
@KheirFerrum KheirFerrum deleted the repair-fix branch November 10, 2023 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash while reinforcing items
2 participants