Fureniku / crafting-station

crafting station
1 stars 4 forks source link

Locked slots change causes moving crafting ingredients from Sophisticated Storage containers to crash #8

Closed RGamberini closed 1 week ago

RGamberini commented 2 weeks ago

Current Behavior

Pressing the "Move items" button from JEI on a crafting station with a Sophisticated Storage chest / barrel attached causes the game to crash with a null pointer exception. Crash Report

Cause

This is caused by the change to support "locked slots" introduced in 1681c41. Notably these lines here. The getContainerFromId function attempts to cast a BlockEntity to a Container and if it can't than it returns null, since SophisticatedStorage containers do not extend Container this returns an unchecked null that crashes the game.

Possible Solution

Assuming that non-container extending tile entities cannot have locked slots, it seems reasonable to skip the locked slots check when the getContainerFromId method returns null. I've submitted a pull request that does this.

This has resolved the bug in my testing environment.

Fureniku commented 1 week ago

Thanks for the PR! Merged into 1.2.3 + credited you in patch notes