OSDN Git Service

kdeplasma-addons: change the weather location widget index only if the pre-location...
authorIvailo Monev <xakepa10@gmail.com>
Sun, 16 Jul 2023 16:34:58 +0000 (19:34 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Sun, 16 Jul 2023 16:34:58 +0000 (19:34 +0300)
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>
kdeplasma-addons/libs/plasmaweather/weatherconfig.cpp

index f601f79..572b9d8 100644 (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);
+        }
     }
 }