Skip to content

Fix latent NRE in Reopen seek and remove dead local#11574

Merged
niksedk merged 1 commit into
mainfrom
fix/reopen-seek-nre-and-dead-var
Jun 12, 2026
Merged

Fix latent NRE in Reopen seek and remove dead local#11574
niksedk merged 1 commit into
mainfrom
fix/reopen-seek-nre-and-dead-var

Conversation

@niksedk

@niksedk niksedk commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

Two small fixes found while bug-hunting the recent commits:

  1. Latent NRE in the Reopen video-seek flow (MainViewModel.cs). The deferred seek lambda re-read the SelectedSubtitle property instead of the already null-checked local snapshot s:

    var s = SelectedSubtitle;
    if (vp != null && s != null)
    {
        vp.Position = s.StartTime.TotalSeconds;
        Dispatcher.UIThread.Post(() => { vp.Position = SelectedSubtitle.StartTime.TotalSeconds; }); // re-reads property

    Because 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. Now uses the captured local s. (The analogous fullscreen path already captures a position local and was unaffected.)

  2. Dead local in SubtitleTextInfoHelper.PopulatecolorTextTooLong became unused when the CPS background gate was switched to ColorCharactersPerSecond. Removed (CS0219 cleanup).

Testing

  • dotnet build src/ui/UI.csproj — succeeds, 0 warnings, 0 errors.

🤖 Generated with Claude Code

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>
@niksedk niksedk merged commit b297031 into main Jun 12, 2026
1 of 3 checks passed
@niksedk niksedk deleted the fix/reopen-seek-nre-and-dead-var branch June 12, 2026 18:54
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.

1 participant