From 645bdd950f4da22dfc3ae3529305af9c018c1792 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Tue, 6 Dec 2016 22:00:58 +0100 Subject: [PATCH] Attract: prevent ui/console errors when no strip exists --- blender_cloud/attract/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/blender_cloud/attract/__init__.py b/blender_cloud/attract/__init__.py index 5d5bc96..84d928b 100644 --- a/blender_cloud/attract/__init__.py +++ b/blender_cloud/attract/__init__.py @@ -70,8 +70,12 @@ def active_strip(context): def selected_shots(context): """Generator, yields selected strips if they are Attract shots.""" + selected_sequences = context.selected_sequences - for strip in context.selected_sequences: + if selected_sequences is None: + return + + for strip in selected_sequences: atc_object_id = getattr(strip, 'atc_object_id') if not atc_object_id: continue @@ -81,6 +85,11 @@ def selected_shots(context): def all_shots(context): """Generator, yields all strips if they are Attract shots.""" + sequence_editor = context.scene.sequence_editor + + if sequence_editor is None: + # we should throw an exception, but at least this change prevents an error + return [] for strip in context.scene.sequence_editor.sequences_all: atc_object_id = getattr(strip, 'atc_object_id')