Skip to content

Comments

fix(previewer): media config not initialized#20122

Merged
mikehardy merged 1 commit intoankidroid:mainfrom
BrayanDSO:fix/previewer-sound
Jan 17, 2026
Merged

fix(previewer): media config not initialized#20122
mikehardy merged 1 commit intoankidroid:mainfrom
BrayanDSO:fix/previewer-sound

Conversation

@BrayanDSO
Copy link
Member

Fixes

Approach

used a nullable config and empty av tags lists instead of lateinit properties.

This avoids crashes. There's still the rare chance of the previewer requesting a sound before it's loaded, which would result in playing nothing. Making that foolproof requires a bigger refactor, which I intend to do later

How Has This Been Tested?

Flaky hammer™: https://github.com/BrayanDSO/Anki-Android/actions/runs/21093913315

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

used a nullable config and empty av tags lists instead of lateinit properties
return
}
if (!cardMediaPlayer.config.autoplay && !doMediaReplay) return
if (cardMediaPlayer.config?.autoplay != true && !doMediaReplay) return
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Asking for some attention on the condition fixes of AbstractFlashcardViewer

@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Jan 17, 2026
Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conditional changes look right, going with empty as default init seems fine as a crash-fix

Flaky hammer™: https://github.com/BrayanDSO/Anki-Android/actions/runs/21093913315

😍

@mikehardy mikehardy added this pull request to the merge queue Jan 17, 2026
@mikehardy mikehardy added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Jan 17, 2026
Merged via the queue into ankidroid:main with commit fde7b98 Jan 17, 2026
19 checks passed
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Jan 17, 2026
@github-actions github-actions bot added this to the 2.24 release milestone Jan 17, 2026
@BrayanDSO BrayanDSO deleted the fix/previewer-sound branch January 17, 2026 21:59
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.

Previewer: kotlin.UninitializedPropertyAccessException: lateinit property config has not been initialized

3 participants