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"
This commit is contained in:
Eduard Braun 2015-12-06 23:47:56 +01:00
parent f0c69b827e
commit ab1aa0e2f8

View file

@ -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 = "";
if len(nums):
prev = nums[len(nums)-1]
if prev[len(prev)-1] in ['e', 'E']:
if prev and prev[len(prev)-1] in ['e', 'E']:
nums[len(nums)-1] = prev + '-' + negcoords[j]
else:
nums.append( '-'+negcoords[j] )