Mercurial > nagslang
comparison tools/area_editor.py @ 461:49f6adde49d0
Protect against corner case crash
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 07 Sep 2013 15:53:20 +0200 |
parents | 41ebc538109c |
children | c2909e9411ae |
comparison
equal
deleted
inserted
replaced
460:0318738e3b84 | 461:49f6adde49d0 |
---|---|
150 break | 150 break |
151 if len(polygon) > 1: | 151 if len(polygon) > 1: |
152 pointlist = [self.point_to_pygame(p) for p in polygon] | 152 pointlist = [self.point_to_pygame(p) for p in polygon] |
153 pygame.draw.lines(self._surface, color, False, pointlist, | 153 pygame.draw.lines(self._surface, color, False, pointlist, |
154 line_width) | 154 line_width) |
155 if index == mouse_poly and mouse_pos: | 155 if index == mouse_poly and mouse_pos and len(polygon) > 0: |
156 endpoint = self.point_to_pymunk(mouse_pos) | 156 endpoint = self.point_to_pymunk(mouse_pos) |
157 pygame.draw.line(self._surface, color, | 157 pygame.draw.line(self._surface, color, |
158 self.point_to_pygame(polygon[-1]), | 158 self.point_to_pygame(polygon[-1]), |
159 self.point_to_pygame(endpoint), | 159 self.point_to_pygame(endpoint), |
160 line_width // 2) | 160 line_width // 2) |