Skip to content

Commit

Permalink
#21 fix index error when issues list is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
semagnum committed Oct 20, 2023
1 parent 7238571 commit d82210a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
bl_info = {
'name': 'BLint',
'author': 'Spencer Magnusson',
'version': (1, 0, 1),
'version': (1, 0, 2),
'blender': (3, 6, 0),
'description': 'Custom project linting',
'location': 'Scene',
Expand Down
17 changes: 9 additions & 8 deletions panels/issues_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ def draw(self, context):
window_manager, 'lint_issues',
window_manager, 'lint_issue_active', columns=4)

if window_manager.lint_issue_active < 0:
window_manager.lint_issue_active = 0
elif window_manager.lint_issue_active >= len(window_manager.lint_issues):
window_manager.lint_issue_active = len(window_manager.lint_issues) - 1

idx = window_manager.lint_issue_active
if not window_manager.lint_issues[idx].fix_expr:
layout.label(text='No fix defined for this issue')
if len(window_manager.lint_issues) != 0:
if window_manager.lint_issue_active < 0:
window_manager.lint_issue_active = 0
elif window_manager.lint_issue_active >= len(window_manager.lint_issues):
window_manager.lint_issue_active = len(window_manager.lint_issues) - 1

idx = window_manager.lint_issue_active
if not window_manager.lint_issues[idx].fix_expr:
layout.label(text='No fix defined for this issue')

row = layout.row()
row.operator(BT_OT_FixIssue.bl_idname, text='Fix selected')
Expand Down

0 comments on commit d82210a

Please sign in to comment.