Skip to content

Commit

Permalink
Avoid key error iterating over devicemappings
Browse files Browse the repository at this point in the history
  • Loading branch information
Grennith committed Sep 21, 2023
1 parent 27a302a commit c21f1cb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mapadroid/mapping_manager/MappingManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c21f1cb

Please sign in to comment.