fix(ui): guard server ping loop against netty NPE crash (#179) - #180
Merged
Conversation
OldServerPinger's legacy-ping fallback can pass a null remote address to netty Bootstrap.connect (checkAddress NPE) when a server entry fails to resolve. Running on the tick thread inside GuiMultiplayer.updateScreen, that NPE bubbled up as a "Ticking screen" ReportedException and hard- crashed the client (typically with ViaForge + an unreachable server). Wrap pingPendingNetworks() in a try/catch so a single bad server ping is logged instead of taking down the whole screen. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Issue #179:进入多人游戏服务器列表页面后客户端崩溃(
Ticking screen/NullPointerException)。根因
vanilla
OldServerPinger的旧版-ping 回退路径在服务器地址解析失败时,会把null地址传给 nettyBootstrap.connect,checkAddress抛 NPE。该异常在GuiMultiplayer.updateScreen → pingPendingNetworks()的 tick 线程上冒泡,导致整个客户端硬崩(典型触发:ViaForge + 一个不可达的服务器条目)。修复
给
pingPendingNetworks()包一层try/catch(Throwable),单个服务器 ping 出错只记日志、不再崩掉整个界面。另一处初始ping()(ServerListEntry)本就在后台线程且已被 try/catch 保护,无需改动。Closes #179
🤖 Generated with Claude Code