[locale] avoid crash when there are no good locales
If the running locale doesn't match any locale in the list, nothing is selected. Avoid a crash when referring to first() of an empty list.
This commit is contained in:
parent
9925d6666f
commit
c4e0456acc
@ -84,5 +84,6 @@ LCLocaleDialog::LCLocaleDialog( const QString& guessedLCLocale, const QStringLis
|
||||
QString
|
||||
LCLocaleDialog::selectedLCLocale()
|
||||
{
|
||||
return m_localesWidget->selectedItems().first()->text();
|
||||
const auto items = m_localesWidget->selectedItems();
|
||||
return items.isEmpty() ? QString{} : items.first()->text();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user