From c21f1cb52412d1f9d73ca85230f238bdb11e3a06 Mon Sep 17 00:00:00 2001 From: Till Skrodzki Date: Thu, 21 Sep 2023 16:20:47 +0300 Subject: [PATCH] Avoid key error iterating over devicemappings --- mapadroid/mapping_manager/MappingManager.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mapadroid/mapping_manager/MappingManager.py b/mapadroid/mapping_manager/MappingManager.py index 37dd33127..262c76e76 100644 --- a/mapadroid/mapping_manager/MappingManager.py +++ b/mapadroid/mapping_manager/MappingManager.py @@ -848,6 +848,10 @@ async def update(self, full_lock=False) -> None: logger.info("Restoring old devicesettings") for dev, mapping in self._devicemappings.items(): + if dev not in devicemappings_tmp: + logger.warning("{} is not in new devicemappings. " + "This is fine in case of autoconfig running during a mappings update.") + continue devicemappings_tmp[dev].last_location = mapping.last_location devicemappings_tmp[dev].last_known_mode = mapping.last_known_mode devicemappings_tmp[dev].account_index = mapping.account_index