diff options
author | Marion <marion.zepf@gmail.com> | 2013-09-08 14:11:04 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-09-08 14:11:04 (GMT) |
commit | 7fe3c377a730a75e15b5d7c23c7ba2f746e0396c (patch) | |
tree | 5ac34cf4fdf774e62498d4f306875f666da64e62 | |
parent | 728aeea62cbdd45332cc2fa804604fb95c3df97f (diff) |
make the get_prim_callable utility a bit more fail-safe
-rw-r--r-- | TurtleArt/talogo.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index b344abe..f4cd7ea 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -209,7 +209,11 @@ class LogoCode: def get_prim_callable(self, name): """ Return the callable primitive associated with the given name """ - return self.oblist[name].fcn + sym = self.oblist.get(name) + if sym is not None: + return sym.fcn + else: + return None def run_blocks(self, code): """Run code generated by generate_code(). |