Skip to content

Commit 22ad5f9

Browse files
committed
Better index check.
1 parent 44157b8 commit 22ad5f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_trellism4.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(self, pin, *, width, height, rotation=0):
6868
def __setitem__(self, index, value):
6969
if not isinstance(index, tuple) or len(index) != 2:
7070
raise IndexError("Index must be tuple")
71-
if index[0] > 7 or index[1] > 7:
71+
if index[0] >= self.width or index[1] >= self.height:
7272
raise IndexError("Pixel assignment outside available coordinates.")
7373

7474
if self._rotation == 0 or self._rotation == 180:

0 commit comments

Comments
 (0)