fix(settings): prevent crash from incomplete translated preference arrays#3250
Open
MiMoHo wants to merge 1 commit into
Open
fix(settings): prevent crash from incomplete translated preference arrays#3250MiMoHo wants to merge 1 commit into
MiMoHo wants to merge 1 commit into
Conversation
…ce entry arrays Opening the settings crashed with an ArrayIndexOutOfBoundsException in ListPreference.getEntry() for locales whose translated entries arrays have fewer items than the corresponding entryValues arrays (at 4.5.2: values-es-rMX ships fontSize_entries with 1 of 3 items, values-ast, values-oc and values-pt-rPT ship darkmode_entries with 2 of 3 items). Since the default values "medium" (index 1) and "SYSTEM_DEFAULT" (index 2) lie beyond those lengths, affected users crash right when the preference list is bound. fontSize_entries and darkmode_entries are now translatable="false" arrays referencing individual translatable strings, the same pattern already used for noteMode_entries_new since nextcloud#768. A missing individual translation falls back to English instead of shifting array positions, so the entries and entryValues arrays can no longer diverge. Fixes nextcloud#3002 Assisted-by: Claude Code:claude-fable-5 AI-assistant: Claude Code 2.1.187 (Claude Fable 5)
Up to standards ✅🟢 Issues
|
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.
Opening Settings crashed with an
ArrayIndexOutOfBoundsExceptioninListPreference.getEntry()on locales whose translated*_entriesarrayshold fewer items than the matching
entryValuesarrays. At 4.5.2 this affects:values-es-rMX— shipsfontSize_entrieswith 1 of 3 itemsvalues-ast,values-oc,values-pt-rPT— shipdarkmode_entrieswith 2 of 3 itemsBecause the defaults
medium(index 1) andSYSTEM_DEFAULT(index 2) sitbeyond those shortened lengths, affected users crash as soon as the preference
list is bound.
Fix:
fontSize_entriesanddarkmode_entriesare nowtranslatable="false"arrays that reference individual translatable strings — the same pattern already
used for
noteMode_entries_new(#768). A missing translation now falls back toEnglish instead of shifting array positions, so
entriesandentryValuescanno longer diverge.
Fixes #3002
🏁 Checklist
/backport to stable-xx.x🤖 AI (if applicable)