fix cursor out of range

This commit is contained in:
Ace 2022-02-08 23:39:29 +01:00 committed by GitHub
parent 6d30060048
commit b00212a9db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,8 +163,9 @@ class Todoist(inkycal_module):
# Add the parsed todos on the image # Add the parsed todos on the image
cursor = 0 cursor = 0
for name, todos in grouped.items(): for name, todos in grouped.items():
if todos != []: if todos:
for todo in todos: for todo in todos:
if cursor < len(line_positions):
line_x, line_y = line_positions[cursor] line_x, line_y = line_positions[cursor]
# Add todo project name # Add todo project name
@ -189,7 +190,7 @@ class Todoist(inkycal_module):
todo['name'], font=self.font, alignment='left') todo['name'], font=self.font, alignment='left')
cursor += 1 cursor += 1
if cursor > max_lines: else:
logger.error('More todos than available lines') logger.error('More todos than available lines')
break break