diff options
author | Walter Bender <walter@sugarlabs.org> | 2010-03-14 17:57:18 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2010-03-14 17:57:18 (GMT) |
commit | 72d2773d8db074e28a9d4780572d35e7e43d3ee6 (patch) | |
tree | bc0a6be0a311c0b48d13da72c91fec78666cb333 | |
parent | cfddb51aa207270384ce50cd5c7508be10457e48 (diff) |
more robust connection checking
-rw-r--r-- | talogo.py | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -512,16 +512,17 @@ class LogoCode: return ['%nothing%'] else: return ['%nothing%'] - for i in range(1, len(blk.connections)): - b = blk.connections[i] - dock = blk.docks[i] - if len(dock)>4: # There could be a '(', ')', '[' or ']'. - for c in dock[4]: - code.append(c) - if b is not None: - code.extend(self.blocks_to_code(b)) - elif blk.docks[i][0] not in ['flow', 'unavailable']: - code.append('%nothing%') + if blk.connections is not None and len(blk.connections) > 0: + for i in range(1, len(blk.connections)): + b = blk.connections[i] + dock = blk.docks[i] + if len(dock)>4: # There could be a '(', ')', '[' or ']'. + for c in dock[4]: + code.append(c) + if b is not None: + code.extend(self.blocks_to_code(b)) + elif blk.docks[i][0] not in ['flow', 'unavailable']: + code.append('%nothing%') return code def setup_cmd(self, string): |