Handle conversion from input QComboBox index to update channel string more safely

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-02-22 20:14:48 +01:00
parent 71fde8876e
commit e30188d8e4

View File

@ -329,21 +329,11 @@ void GeneralSettings::slotUpdateChannelChanged(const QString &translatedChannel)
};
const auto updateChannelFromLocalized = [](const int index) {
auto channel = QString{};
switch (index)
{
case 0:
channel = QStringLiteral("stable");
break;
case 1:
channel = QStringLiteral("beta");
break;
default:
channel = QString{};
if (index == 1) {
return QStringLiteral("beta");
}
return channel;
return QStringLiteral("stable");
};
const auto channel = updateChannelFromLocalized(_ui->updateChannel->currentIndex());