Skip to content

fix(settings): prevent crash from incomplete translated preference arrays#3250

Open
MiMoHo wants to merge 1 commit into
nextcloud:mainfrom
MiMoHo:fix/3002-settings-crash-translated-arrays
Open

fix(settings): prevent crash from incomplete translated preference arrays#3250
MiMoHo wants to merge 1 commit into
nextcloud:mainfrom
MiMoHo:fix/3002-settings-crash-translated-arrays

Conversation

@MiMoHo

@MiMoHo MiMoHo commented Jul 3, 2026

Copy link
Copy Markdown

Opening Settings crashed with an ArrayIndexOutOfBoundsException in
ListPreference.getEntry() on locales whose translated *_entries arrays
hold fewer items than the matching entryValues arrays. At 4.5.2 this affects:

  • values-es-rMX — ships fontSize_entries with 1 of 3 items
  • values-ast, values-oc, values-pt-rPT — ship darkmode_entries with 2 of 3 items

Because the defaults medium (index 1) and SYSTEM_DEFAULT (index 2) sit
beyond those shortened lengths, affected users crash as soon as the preference
list is bound.

Fix: fontSize_entries and darkmode_entries are now translatable="false"
arrays that reference individual translatable strings — the same pattern already
used for noteMode_entries_new (#768). A missing translation now falls back to
English instead of shifting array positions, so entries and entryValues can
no longer diverge.

Fixes #3002

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was fully generated using Claude Code: claude-fable-5

…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)
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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.

index outbound exception on open config settings

1 participant