Skip to content

Commit 2560cd0

Browse files
committed
__getitem__ uses self._n instead of self._buf // 4
- self._buf would be incorrect if there are headers - adafruit#9
1 parent f9e5675 commit 2560cd0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_dotstar.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def __setitem__(self, index, val):
162162
def __getitem__(self, index):
163163
if isinstance(index, slice):
164164
out = []
165-
for in_i in range(*index.indices(len(self._buf) // 4)):
165+
for in_i in range(*index.indices(self._n)):
166166
out.append(
167167
tuple(self._buf[in_i * 4 + (3 - i) + self.start_header_size] for i in range(3)))
168168
return out

0 commit comments

Comments
 (0)