Collection Manager: Fix invalid list index. Task: T69577

Fix error when trying to add a new collection if the selected
collection was deleted using the Outliner.
This commit is contained in:
Ryan Inch 2020-05-23 01:12:36 -04:00
parent 92cfcccf0c
commit c673be0c38
2 changed files with 5 additions and 1 deletions

View File

@ -22,7 +22,7 @@ bl_info = {
"name": "Collection Manager",
"description": "Manage collections and their objects",
"author": "Ryan Inch",
"version": (2, 7, 23),
"version": (2, 7, 24),
"blender": (2, 80, 0),
"location": "View3D - Object Mode (Shortcut - M)",
"warning": '', # used for warning icon and text in addons panel

View File

@ -335,6 +335,10 @@ class CollectionManager(Operator):
self.view_layer = view_layer.name
# make sure list index is valid
if cm.cm_list_index >= len(cm.cm_list_collection):
cm.cm_list_index = -1
# check if expanded & history/buffer state still correct
if collection_state:
new_state = generate_state()