Fix potential race condition with locale, most likely fixes #3789

This commit is contained in:
Amelia 2025-05-15 16:00:11 +02:00
parent db77e08264
commit fd93c4d0d4

View file

@ -110,7 +110,12 @@ export class ManageUserPreferencesComponent implements OnInit {
get Locale() {
if (!this.settingsForm.get('locale')) return 'English';
return (this.locales || []).filter(l => l.fileName === this.settingsForm.get('locale')!.value)[0].renderName;
const locale = (this.locales || []).find(l => l.fileName === this.settingsForm.get('locale')!.value);
if (!locale) {
return 'English';
}
return locale.renderName;
}