Repository navigation
EndGame APM stats: no error when the stats panel is not there - #5885
Open
moss-orbit-9f339e wants to merge 1 commit into
Open
moss-orbit-9f339e wants to merge 1 commit into
moss-orbit-9f339e wants to merge 1 commit into
Conversation
During Shutdown the panel widget can be unloaded first, so WG.AddPlayerStatsToPanel was nil (107 crash reports). Check it before the call; the stats message is still sent. Co-Authored-By: Claude Opus 5.5 <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.
api_apm_stats.luasends the player's stats when the player leaves or the game ends, and callsWG.AddPlayerStatsToPanel. The end-game window widget sets that function only when it loads. When the player has turned that widget off, the function is nil, and the call fails at line 71. This change checks the function before both calls. The stats message is still sent.107 crash reports in one year have this error, for example ZeroK-RTS/CrashReports#183033 and ZeroK-RTS/CrashReports#182512.
Behaviour: no change, except that the error is gone.
Testing (Windows, RTX 3080, master ee8950e):
WG.AddPlayerStatsToPanel(the state when the widget was never loaded). The player quits at frame 300. Without this change:api_apm_stats.lua:71: attempt to call field 'AddPlayerStatsToPanel' (a nil value)inShutdown. With this change: no error.AI disclosure: Claude Code wrote this change and the tests. I reviewed the change.