From ab1aa0e2f8cb3faf1487249eea56cf83906b1f39 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 6 Dec 2015 23:47:56 +0100 Subject: [PATCH] Fix a bug with "points" attribute of "polyline/polygon" starting with a negative number. In this case "len(nums) = 0" and "nums[len(nums)-1]" triggered an "IndexError: list index out of range" --- scour/scour.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scour/scour.py b/scour/scour.py index a274a60..335bd0e 100644 --- a/scour/scour.py +++ b/scour/scour.py @@ -2145,8 +2145,10 @@ def parseListOfPoints(s): else: # unless we accidentally split a number that was in scientific notation # and had a negative exponent (500.00e-1) - prev = nums[len(nums)-1] - if prev[len(prev)-1] in ['e', 'E']: + prev = ""; + if len(nums): + prev = nums[len(nums)-1] + if prev and prev[len(prev)-1] in ['e', 'E']: nums[len(nums)-1] = prev + '-' + negcoords[j] else: nums.append( '-'+negcoords[j] )