Skip to content

Commit 9dd39cb

Browse files
committed
made LinearGradient more foregiving (unsure it is a good idea)
1 parent 860d7fd commit 9dd39cb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

larray_editor/utils.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,8 @@ def __getitem__(self, key):
282282
-------
283283
QColor
284284
"""
285-
if np.isnan(key):
285+
if np.isnan(key) or key < 0 or key > 1:
286286
return self.nan_color
287-
# this is enough to also avoid nan, inf & -inf
288-
assert 0 <= key <= 1
289287
pos_idx = np.searchsorted(self.positions, key, side='right') - 1
290288
# if we are exactly on one of the bounds
291289
if pos_idx > 0 and key in self.positions:

0 commit comments

Comments
 (0)