From 1b4590d79c46385e06ca5d9e4a60fb20ac4c56a1 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Fri, 11 Nov 2011 21:13:02 +0000 Subject: bounds check needed when block definitions are missing --- (limited to 'TurtleArt') diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index eaaed3a..03bfe1c 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -1353,8 +1353,8 @@ class TurtleArtWindow(): newblk.connections[i + 1] = argblk self.drag_group = find_group(newblk) self.block_operation = 'new' - if newblk.spr.labels[0] is not None and \ - newblk.name not in ['', 'number', 'string']: + if len(newblk.spr.labels) > 0 and newblk.spr.labels[0] is not None \ + and newblk.name not in ['', 'number', 'string']: if newblk.spr.labels[0] not in self.used_block_list: if len(self.used_block_list) > 0: self.used_block_list.append(', ') @@ -2833,7 +2833,7 @@ class TurtleArtWindow(): blk.spr.set_layer(BLOCK_LAYER) if check_dock: blk.connections = 'check' - if self.running_sugar and blk.spr.labels[0] is not None and \ + if self.running_sugar and len(blk.spr.labels) > 0 and \ blk.name not in ['', ' ', 'number', 'string']: if blk.spr.labels[0] not in self.used_block_list: if len(self.used_block_list) > 0: -- cgit v0.9.1