Skip to content

Commit 106a74c

Browse files
mmstanoemontnemery
andauthored
Prevent AttributeError in luci device tracker (home-assistant#148357)
Co-authored-by: Erik Montnemery <[email protected]>
1 parent 8464dad commit 106a74c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

homeassistant/components/luci/device_tracker.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,12 @@ def get_extra_attributes(self, device):
8484
(ip), reachable status (reachable), associated router
8585
(host), hostname if known (hostname) among others.
8686
"""
87-
device = next(
88-
(result for result in self.last_results if result.mac == device), None
89-
)
87+
if not (
88+
device := next(
89+
(result for result in self.last_results if result.mac == device), None
90+
)
91+
):
92+
return {}
9093
return device._asdict()
9194

9295
def _update_info(self):

0 commit comments

Comments
 (0)