changeset 461:49f6adde49d0

Protect against corner case crash
author Neil Muller <drnlmuller@gmail.com>
date Sat, 07 Sep 2013 15:53:20 +0200
parents 0318738e3b84
children c2909e9411ae
files tools/area_editor.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tools/area_editor.py	Sat Sep 07 15:42:37 2013 +0200
+++ b/tools/area_editor.py	Sat Sep 07 15:53:20 2013 +0200
@@ -152,7 +152,7 @@
                 pointlist = [self.point_to_pygame(p) for p in polygon]
                 pygame.draw.lines(self._surface, color, False, pointlist,
                                   line_width)
-            if index == mouse_poly and mouse_pos:
+            if index == mouse_poly and mouse_pos and len(polygon) > 0:
                 endpoint = self.point_to_pymunk(mouse_pos)
                 pygame.draw.line(self._surface, color,
                                  self.point_to_pygame(polygon[-1]),