Traveler's Backpack

Traveler's Backpack

34M Downloads

Crash placing Traveler's Backpack via non-player means

James103 opened this issue ยท 2 comments

commented
  1. ALWAYS PROVIDE INFORMATION ABOUT MODLOADER (Fabric / Forge) AND MOD VERSION (For Example 1.19.2-8.2.10)

Mod pack: All the Mods 9 for Minecraft 1.20.1
Mod loader: Forge
Mod version: 9.1.12

Describe the bug

if(!context.canPlace() || (context.getHand() == InteractionHand.MAIN_HAND && !context.getPlayer().isCrouching()))

When a Traveler's Backpack is tried to be placed by a Dispenser using Quark's Dispensers Place Blocks module, the game crashes because context.getPlayer().isCrouching() is tried to be accessed, but context.getPlayer() is null.

Steps to reproduce

  1. Install Quark and Traveler's Backpacks.
  2. Enable the Dispensers Place Blocks module in Quark.
  3. Get a dispenser, a lever, and a Traveler's Backpack.
  4. Place down the dispenser on level ground, and put a Traveler's Backpack inside it.
  5. Power the dispenser.
  6. The game crashes.

Expected behaviour

There should be a check to make sure context.getPlayer() exists (i.e. it is non-null) before trying to access context.getPlayer().isCrouching()

Originally reported in AllTheMods/ATM-9#1512

Crash report

https://gist.github.com/NavajoCody/938a0cceb7bc5902a5fe58f4c71ddc18