diff options
author | Marion <marion.zepf@gmail.com> | 2013-11-02 10:46:46 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-11-02 10:46:46 (GMT) |
commit | 7324e6cda8abae54111c5f886c8069812fb040bc (patch) | |
tree | 6cc3678c114bdc7acb8087e85e1fcad0e45624e8 /TurtleArt | |
parent | 1de9124a7af7802db43e86891d99b5eaed564c19 (diff) |
Fixes #4641 "Save as Python fails when stack is empty"
Check whether the list is empty before accessing an element.
Diffstat (limited to 'TurtleArt')
-rw-r--r-- | TurtleArt/taexportpython.py | 2 |
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)) |