Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarion <marion.zepf@gmail.com>2013-11-02 10:46:46 (GMT)
committer Marion <marion.zepf@gmail.com>2013-11-02 10:46:46 (GMT)
commit7324e6cda8abae54111c5f886c8069812fb040bc (patch)
tree6cc3678c114bdc7acb8087e85e1fcad0e45624e8
parent1de9124a7af7802db43e86891d99b5eaed564c19 (diff)
Fixes #4641 "Save as Python fails when stack is empty"fix-issue-4641
Check whether the list is empty before accessing an element.
-rw-r--r--TurtleArt/taexportpython.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/TurtleArt/taexportpython.py b/TurtleArt/taexportpython.py
index 458b886..c7d903d 100644
--- a/TurtleArt/taexportpython.py
+++ b/TurtleArt/taexportpython.py
@@ -116,7 +116,7 @@ def _action_stack_to_python(block, tw, name="start"):
# traverse the block stack and get the AST for every block
ast_list = _walk_action_stack(block, tw.lc)
- if not isinstance(ast_list[-1], ast.Yield):
+ if not ast_list or not isinstance(ast_list[-1], ast.Yield):
ast_list.append(ast_yield_true())
action_stack_ast = ast.Module(body=ast_list)
#debug_output(str(action_stack_ast))