Fix crash when opening settings after upgrading from previous version and having old theme selected #1778
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.
Closes #1772
Fix
What was happening
ListPreference crashes on resume because a deprecated theme value stored in SharedPreferences is an invalid index for the newly shortened resource array.
User selects 'Auto' theme (value 2) before it was deprecated.
The user's preference is stored in SharedPreferences. In an older version, the theme options included 'Auto' which corresponded to a value that is now invalid or points to a different entry.
The 'Auto' theme was removed in commit c43d0ad. The array_theme_values for API 29+ now only contains 3 items (0, 1, 2), but the user's stored value might be 3 (System) or 2 (Auto, which is now System).
0 1 2Fix:
Added a workaround to comply with existing saved preference where the options array included more values than the new array has in newer versions, so this ListPreference extension checks for bounds to prevent IOBException and defaults to the system value
Test
go to Build -> Generate Signed App Bundle or APK, choose APK, then populate the fields with the secret store data in gradle.properties, or ping me for to DM you a signed APK.
In the following video I show you all 3 updates:
Screen.Recording.2025-10-17.at.7.11.36.PM.mov
Review
Release