Repository navigation
Conversation
|
i think this is all setting a bad precedent instead of adding null checks everywhere we should tighten the code to prevent nullness altogether:
#6722 should be fixed in a different way, if built-in assets have issues loading we should be failing fast rather than silently ignoring it |
…dules that throw instead of crashing
cad3a0d to
ecfe83a
Compare
|
fair, reworked it. the null checks are gone and it fixes the actual causes now (also my #6360 change was in the wrong class, the crash was WWindow's header not WMeteorSection):
but i don't think it should be all or nothing, so i kept one safety net: if a module's event handler throws, that module gets disabled, the full error is logged and the user gets told in chat which module crashed. anything not from a module still crashes like before, so nothing gets silently swallowed. lmk if you'd rather that be its own pr |
|
your also the modules/event bus changes should be done by a human rather than a machine |
|
should clarify, the modules/event bus changes as-is are bad, you want the added friction of the game closing in the case where a crash would happen otherwise the error and subsequent debug information goes ignored and unreported |
Type of change
Description
Reworked after review: instead of null checks this fixes why things were null, and adds one safety net so a broken module doesn't take the whole game down.
Modules ticking without a world (#6599)
Module listeners are only managed by
GameJoinedEvent/GameLeftEvent, so anything that loses the world or player without a leave event (crash recovery mods returning to the title screen, the world still loading after join) left modules ticking withmc.player == null.Modules.updateModuleSubscriptions()now runs before every tick and removes module listeners while there's no world or player, then adds them back once both exist. NoonActivate/onDeactivatecalls since there's no player to use in them.Half-built screens (#6360)
WidgetScreen.init()setfirstInit = falsebeforeinitWidgets(), so if building the widgets threw once the screen was never rebuilt and kept rendering a half-initialised window (thetriangleNPE inWWindow$WHeader). It's now only marked as built afterinitWidgets()succeeds, so a failure shows its real error instead.Built-in textures fail fast (#6722)
Texture.readResourcereturnednullfor a missing or unreadable resource, which then crashed later in the GUI renderer. It now throws with the path and the decode error, and the empty spawn egg texture is loaded at startup inGuiRenderer.init()instead of lazily when the entity list opens.Safety net
MeteorEventBusextends orbit'sEventBus: if an exception comes from a module's event handler, that module is disabled, the full error is logged and the user gets a chat message saying which module crashed. Exceptions that don't come from a module are rethrown as before, so nothing else is silently swallowed.Closes #6599
Closes #6360
Closes #6722