From 9eb152aae60ba5e6f4352346c1283dc7efc5790e Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 16 Jul 2023 19:34:58 +0300 Subject: [PATCH] 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 --- kdeplasma-addons/libs/plasmaweather/weatherconfig.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kdeplasma-addons/libs/plasmaweather/weatherconfig.cpp b/kdeplasma-addons/libs/plasmaweather/weatherconfig.cpp index f601f79f..572b9d8d 100644 --- a/kdeplasma-addons/libs/plasmaweather/weatherconfig.cpp +++ b/kdeplasma-addons/libs/plasmaweather/weatherconfig.cpp @@ -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); + } } }