fix(previewer): media config not initialized#20122
Merged
mikehardy merged 1 commit intoankidroid:mainfrom Jan 17, 2026
Merged
Conversation
used a nullable config and empty av tags lists instead of lateinit properties
BrayanDSO
commented
Jan 17, 2026
| return | ||
| } | ||
| if (!cardMediaPlayer.config.autoplay && !doMediaReplay) return | ||
| if (cardMediaPlayer.config?.autoplay != true && !doMediaReplay) return |
Member
Author
There was a problem hiding this comment.
Asking for some attention on the condition fixes of AbstractFlashcardViewer
david-allison
approved these changes
Jan 17, 2026
mikehardy
approved these changes
Jan 17, 2026
Member
mikehardy
left a comment
There was a problem hiding this comment.
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
😍
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.
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.