kdeplasma-addons: change the weather location widget index only if the pre-location index is found

when a source is set is not added as item to the location widget (see
WeatherConfig::setSource())

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-07-16 19:34:58 +03:00
parent 8558ee30fe
commit 9eb152aae6

View file

@ -203,7 +203,9 @@ void WeatherConfig::Private::locationFinished()
{
if (!preLocationText.isEmpty()) {
const int preLocationIndex = ui.locationCombo->findText(preLocationText);
ui.locationCombo->setCurrentIndex(preLocationIndex);
if (preLocationIndex >= 0) {
ui.locationCombo->setCurrentIndex(preLocationIndex);
}
}
}