Advanced Peripherals

Advanced Peripherals

29M Downloads

NullPointerException when using ME Bridge .craftItem with CPU name

TheIncgi opened this issue ยท 1 comments

commented

Describe

Null pointer exception happens here when using a ME Network with some un-named CPUs (but not always) when calling .craftItem with a CPU name

Here's the only part of the stacktrace that was visible from the server console:

20.08 00:00:19 [Server] ComputerCraft-Coroutine-6/ERROR [computercraft/]: Error calling call on dan200.computercraft.core.apis.PeripheralAPI@3caf1a5
20.08 00:00:19 [Server] INFO java.lang.NullPointerException: null
20.08 00:00:19 [Server] INFO at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?] {re:mixin}
20.08 00:00:19 [Server] INFO at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.MeBridgePeripheral.getCraftingCPU(MeBridgePeripheral.java:512) ~[AdvancedPeripherals-1.19.2-0.7.30r.jar%23229!/:0.7.30r] {re:classloading}
20.08 00:00:19 [Server] INFO at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.MeBridgePeripheral.craftItem(MeBridgePeripheral.java:158) ~[AdvancedPeripherals-1.19.2-0.7.30r.jar%23229!/:0.7.30r] {re:classloading}
20.08 00:00:19 [Server] INFO at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.MeBridgePeripheral$cc$craftItem161.apply(CC generated method) ~[?:?] 

Naming all CPUs works as a workaround for this bug.

Steps to reproduce

  1. Build a ME network with a bunch of un-named CPUs.
  2. Add one named CPU
  3. Add a crafting recipe
  4. Attempt to craft using the named CPU

From what I can tell, the un-named CPU's are iterated on first where the name is null throwing the error.
Changing it to skip CPUs here with missing names is likely all that's needed to fix this bug.

Multiplayer?

Yes

Version

1.19.2-0.7.30r (Latest 1.19.2)

Minecraft, Forge and maybe other related mods versions

Forge - 43.2.21

Screenshots or Videos

No response

Crashlog/log

No response

commented

Snapshot to test these changes -> Intelligence Repository