Skip to content

Fixed curio related logspam#2139

Merged
wrincewind merged 1 commit intoWayofTime:1.20.1from
Saereth:logspam
Dec 15, 2025
Merged

Fixed curio related logspam#2139
wrincewind merged 1 commit intoWayofTime:1.20.1from
Saereth:logspam

Conversation

@Saereth
Copy link
Copy Markdown
Contributor

@Saereth Saereth commented Dec 11, 2025

#2085 and #2040
Added null-safety checks:

  1. Check if curioInv.isEmpty() before calling .get()
  2. Check if livingArmourSockets == null before using it

Fixes WayofTime#2085
 Added null-safety checks:
  1. Check if curioInv.isEmpty() before calling .get()
  2. Check if livingArmourSockets == null before using it
@wrincewind
Copy link
Copy Markdown
Collaborator

wrincewind commented Dec 14, 2025

I've had a look and am unable to replicate this issue in live - i'm not seeing logspam on death, or when wearing living armour, or when playing in a small pack wth Corail Tombstone. Were you able to replicate this issue before deploying your fix, and if so, how?

As far as i know this was fixed by #2045, for reference.

@Saereth
Copy link
Copy Markdown
Contributor Author

Saereth commented Dec 14, 2025

The Problem is the original code - assumes everything exists
ICurioStacksHandler livingArmourSockets = CuriosApi.getCuriosInventory(player).resolve().get().getCurios().get("living_armour_socket");

This chain fails if:

  • resolve() returns an empty Optional -> .get() throws NoSuchElementException
  • The "living_armour_socket" slot doesn't exist -> returns null, then next operation NPEs
    Optional<ICuriosItemHandler> curioInv = CuriosApi.getCuriosInventory(player).resolve();

if (curioInv.isEmpty()) { return 0; } // Guard #1
ICurioStacksHandler livingArmourSockets = curioInv.get().getCurios().get("living_armour_socket");`

if (livingArmourSockets == null) { return 0; } // Guard #2

Why it helps:

  • Returns early with 0 instead of crashing/spamming logs
  • Handles edge cases like Curios not being fully initialized, or the slot type not being registered yet, or having been removed.

Hope that clears it up, happy to elaborate more if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants