fix(settings): prevent crash from incomplete translated preference arrays#3250
fix(settings): prevent crash from incomplete translated preference arrays#3250MiMoHo 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
|
|
Thanks for the nice fix. Can you sign DCO? |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
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)