Fix latent NRE in Reopen seek and remove dead local#11574
Merged
Conversation
The deferred seek lambda in the Reopen flow re-read the SelectedSubtitle property instead of the null-checked local snapshot. Since the post runs on a later UI tick, closing the file or clearing the selection in that window would make SelectedSubtitle null and throw an NRE on the UI thread. Use the captured local `s`, which is already null-checked. Also drop the now-unused colorTextTooLong local in SubtitleTextInfoHelper.Populate (CPS coloring switched to ColorCharactersPerSecond). 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.
Summary
Two small fixes found while bug-hunting the recent commits:
Latent NRE in the Reopen video-seek flow (
MainViewModel.cs). The deferred seek lambda re-read theSelectedSubtitleproperty instead of the already null-checked local snapshots:Because the
Postruns on a later UI tick, closing the file or clearing the selection in that window would makeSelectedSubtitlenull and throw an NRE on the UI thread. Now uses the captured locals. (The analogous fullscreen path already captures apositionlocal and was unaffected.)Dead local in
SubtitleTextInfoHelper.Populate—colorTextTooLongbecame unused when the CPS background gate was switched toColorCharactersPerSecond. Removed (CS0219 cleanup).Testing
dotnet build src/ui/UI.csproj— succeeds, 0 warnings, 0 errors.🤖 Generated with Claude Code