From 72d2773d8db074e28a9d4780572d35e7e43d3ee6 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sun, 14 Mar 2010 17:57:18 +0000 Subject: more robust connection checking --- (limited to 'talogo.py') diff --git a/talogo.py b/talogo.py index 99c2725..666f9c3 100644 --- a/talogo.py +++ b/talogo.py @@ -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): -- cgit v0.9.1