Skip to content

Unsubscribe in-game modules when player or world is unavailable - #6800

Open
maartix1 wants to merge 5 commits into
MeteorDevelopment:masterfrom
maartix1:fix/null-player-guards-upstream-clean
Open

maartix1 wants to merge 5 commits into
MeteorDevelopment:masterfrom
maartix1:fix/null-player-guards-upstream-clean

Conversation

@maartix1

@maartix1 maartix1 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Type of change

  • Bug fix
  • New feature

Description

Fix #6599 by synchronizing module event subscriptions with player and world availability instead of relying on local null guards.

Related issues

Closes #6599

How Has This Been Tested?

Compiled the code successfully.
Launched the game to verify that it starts correctly.

Checklist:

  • My code follows the style guidelines of this project.
  • I have added comments to my code in more complex areas.
  • I have tested the code in both development and production environments.

@maartix1
maartix1 force-pushed the fix/null-player-guards-upstream-clean branch from 2812d9a to a337b04 Compare November 13, 2026 17:29
@maartix1 maartix1 changed the title Fix/null player guards upstream clean Prevent null player access in AirPlace and inventory utilities Nov 13, 2026

@Gingerbeard5773 Gingerbeard5773 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to quote @crosby-moe
"i think this is all setting a bad precedent, instead of adding null checks everywhere we should tighten the code to prevent nullness altogether"

id suggest reading the conversation in #6734

meteor modules shouldn't ever need null checks for mc.player or mc.level under events like onTick and onRender (unless the module has been explicitly granted permission to run in the main menu using runInMainMenu)

InvUtils/FindItemResult funcs are never supposed to be called when mc.player/ mc.level is null, so those null checks shouldn't really exist either.

@maartix1 maartix1 changed the title Prevent null player access in AirPlace and inventory utilities Unsubscribe in-game modules when player or world is unavailable Nov 13, 2026
@maartix1
maartix1 force-pushed the fix/null-player-guards-upstream-clean branch from 2703a8a to 12f3994 Compare November 13, 2026 21:05
@maartix1

Copy link
Copy Markdown
Contributor Author

to quote @crosby-moe "i think this is all setting a bad precedent, instead of adding null checks everywhere we should tighten the code to prevent nullness altogether"

id suggest reading the conversation in #6734

meteor modules shouldn't ever need null checks for mc.player or mc.level under events like onTick and onRender (unless the module has been explicitly granted permission to run in the main menu using runInMainMenu)

InvUtils/FindItemResult funcs are never supposed to be called when mc.player/ mc.level is null, so those null checks shouldn't really exist either.

Thanks for the feedback. I understand the concern about adding null checks instead of enforcing the expected lifecycle. Is my code okay now?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Player null check lost.

2 participants