Oversized stacks should be handled more gracefully
warjort opened this issue ยท 3 comments
As per #2196 and its discussion #2199
Code like this
can lead to unloadble worlds when the capacity < stack size.
It will always crash because working item amounts become negative which fails sanity checks elsewhere.
The crash means it can't be fixed in game.
Reasons for this to occur maybe:
- A bug in a mod
- Somebody cheating in an oversize stack
- Installing a mod that increases max stack sizes then removing that mod
The transfer api should handle these oversize stacks more gracefully without crashing.
Probably a good addition to #2189.
It's good practice to have the return inserted
inside the if (inserted > 0) {
for exactly this reason, I don't know why I didn't do that for a few implementations... #2189 contains a fix now.