Sophisticated Storage

Sophisticated Storage

36M Downloads

[BUG] NullPointerException Extracting Item from Storage with Compression Upgraded

KhloeLeclair opened this issue ยท 3 comments

commented

Description
Within CompressionInventoryPart.extractItem, the following line of code can throw a NullPointerException:

int toExtract = Math.min(calculatedStacks.get(slot).getCount(), amount);

We believe this happened as a result of the amount of a stored item hitting zero when Create was trying to extract more than one thing at once (netherite blocks + netherite ingots, in this case, extracted via Packager upon request of a factory gauge) but I haven't been able to follow the logic enough to determine the exact cause yet.

Minecraft Version
1.21.1

Mod Version

  • Sophisticated Core: 1.21.1-1.3.74.1158
  • Sophisticated Storage: 1.21.1-1.5.6.1301
  • Create: 1.21.1-6.0.6

Crash Log
https://mclo.gs/s9kfydC

commented

Do you have steps / setup I can use to recreate. I don't think anything can extract from two slots at once because there need to be 2 calls made for what you mentioned.
Also I am not liking that I am seeing a ton of fabric mods and sinytra connector there, they could be doing all kinds of stuff here.

commented

Just to add from my side, I have added a few unit tests to make sure that extracting from incorrect slot - inaccessible marked with red cross - properly returns just empty stack and a test that extracts everything and then tries to continue extracting - like the case you mention above where netherite block is extracted and it then tries to extract netherite ingot which no longer exists - and that test also works properly and just returns empty.
The reason this works properly is that when the last item is extracted the logic removes definitions for what items can go into what slot and how they compress and when no slot definition is present extract just immediately exits returning empty stack without checking anything else.
So I have two new unit tests, but don't see any issue anywhere and definitely need more info on how I can try to recreate this issue.

commented

I have been having a similar issue with my set up for auto sieving and crushing in atm10tts. I have attached my reddit post asking for help it has some pictures which might help figure out what the issue is. I initially thought it had to do with the chest not registering the items within it correctly because it is saying the calculated stack is returning null, so I upgraded the chest to try and ensure that items were always in them, but it was still causing the issue. It even got to the point were it was stopping us from logging onto the server by saying there is invalid player data.

Here is the reddit link: https://www.reddit.com/r/allthemods/comments/1o2lz39/atm10tts_invalid_player_data_caused_by/

I hope this helps try and fix the issue as my whole set up revolves around those upgrades.