From 7d571d855fdc4b1f832856effa6358a966e71707 Mon Sep 17 00:00:00 2001 From: Alessio85 Date: Mon, 13 Apr 2026 18:46:43 +0200 Subject: [PATCH] device: Fix crash in NotificationFlag.flag_names when flags is None (#3185) flag_names() crashes with AttributeError when NotificationFlag returns a value whose .name attribute is None. This occurs with certain receiver firmware versions (Nano C52F, Unifying C52B, Bolt C548). Return an empty list instead, consistent with the List[str] return type. Fixes #3184 Co-authored-by: avercelli --- lib/logitech_receiver/hidpp10_constants.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/logitech_receiver/hidpp10_constants.py b/lib/logitech_receiver/hidpp10_constants.py index 62a725b3..fa3a8395 100644 --- a/lib/logitech_receiver/hidpp10_constants.py +++ b/lib/logitech_receiver/hidpp10_constants.py @@ -91,6 +91,8 @@ class NotificationFlag(IntFlag): @classmethod def flag_names(cls, flags) -> List[str]: """Extract the names of the flags from the integer.""" + if flags is None or flags.name is None: + return [] return flags.name.replace("_", " ").lower().split("|") NUMPAD_NUMERICAL_KEYS = 0x800000