Skip to content

Commit 3240b53

Browse files
committed
Handle out of bounds categories
1 parent 68e62f9 commit 3240b53

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

adafruit_ble/services/apple.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ def update(self, event_flags, category_id, category_count):
162162
def __str__(self):
163163
# pylint: disable=too-many-branches
164164
flags = []
165-
category = NOTIFICATION_CATEGORIES[self.category_id]
165+
category = None
166+
if self.category_id < len(NOTIFICATION_CATEGORIES):
167+
category = NOTIFICATION_CATEGORIES[self.category_id]
166168

167169
if self.silent:
168170
flags.append("silent")

0 commit comments

Comments
 (0)