Skip to content

Commit

Permalink
Fix for Pack operator's poll erro (#119)
Browse files Browse the repository at this point in the history
There was an error visible in console, when user removed export node, looks like it tried to poll the last item in the list that didn't exist anymore
  • Loading branch information
HenryOfCarim authored Aug 20, 2024
1 parent 83f5a9e commit 6d9db23
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions albam/blender_ui/export_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,19 @@ def _execute(self, context): # pragma: no cover
def poll(cls, context):
vfs_e = context.scene.albam.exported
vfs_i = context.scene.albam.vfs
# TODO: simplify this mess
if len(vfs_e.file_list) == 0 or len(vfs_i.file_list) == 0:
return False
index_e = vfs_e.file_list_selected_index
index_i = vfs_i.file_list_selected_index
exported_item = vfs_e.file_list[index_e]
imported_item = vfs_i.file_list[index_i]
if index_e < (len(vfs_e.file_list)):
exported_item = vfs_e.file_list[index_e]
else:
return False
if index_i < (len(vfs_i.file_list)):
imported_item = vfs_i.file_list[index_i]
else:
return False
if not exported_item or not imported_item:
return False
return imported_item.is_archive and exported_item.is_root
Expand Down

0 comments on commit 6d9db23

Please sign in to comment.