Fix: Check indexes before using min() (#330)

This commit is contained in:
Yinhr 2024-02-18 00:10:49 +08:00 committed by GitHub
parent 4fb1c85d98
commit 617be88a71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -165,6 +165,11 @@ class DraggableDungeonList(DraggableList):
indexes = [self.keyword2index(row.matched_keyword)
for row in self.cur_buttons]
indexes = [index for index in indexes if index]
if not indexes:
logger.warning(f'No valid rows loaded into {self}')
return
self.cur_min = min(indexes)
self.cur_max = max(indexes)
logger.attr(self.name, f'{self.cur_min} - {self.cur_max}')