From 7a23a4111041e7c6e80445b5540bc7203fa360d3 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Mon, 26 Mar 2012 18:56:52 +0000 Subject: fix problem with trash palette after dynamic plugin loading --- (limited to 'TurtleArt/tawindow.py') diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 9bd4e47..3fd958a 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -861,6 +861,12 @@ class TurtleArtWindow(): # Reload the palette, but reuse the existing blocks # If a block doesn't exist, add it + if not n < len(self.palettes): + debug_output( + '_create_proto_blocks: palette index %d is out of range' % (n), + self.running_sugar) + return + for blk in self.palettes[n]: blk.spr.hide() old_blocks = self.palettes[n][:] @@ -915,6 +921,11 @@ class TurtleArtWindow(): palette = self.previous_palette # Hide previously selected palette if palette is not None: + if not palette < len(self.palettes): + debug_output( + '_hide_previous_palette: index %d is out of range' % \ + (palette), self.running_sugar) + return for proto in self.palettes[palette]: proto.spr.hide() if self.palette_sprs[palette][self.orientation] is not None: -- cgit v0.9.1