Skip to content

Commit 5cc963b

Browse files
committed
fix wrong number parsing
1 parent 7000c8c commit 5cc963b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Source/SVGImage/SVG/Shapes/LengthPercentageOrNumber.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
using System;
22

33
namespace SVGImage.SVG.Shapes
4-
{
4+
{
5+
using System.Globalization;
56
using System.Text.RegularExpressions;
67

78
public struct LengthPercentageOrNumber
@@ -163,7 +164,7 @@ public LengthPercentageOrNumber(double value, LengthContext context)
163164
public static LengthPercentageOrNumber Parse(Shape owner, string value, LengthOrientation orientation = LengthOrientation.None)
164165
{
165166
var lengthMatch = _lengthRegex.Match(value.Trim());
166-
if(!lengthMatch.Success || !Double.TryParse(lengthMatch.Groups["Value"].Value, out double d))
167+
if(!lengthMatch.Success || !Double.TryParse(lengthMatch.Groups["Value"].Value, NumberStyles.Any, CultureInfo.InvariantCulture, out double d))
167168
{
168169
throw new ArgumentException($"Invalid length/percentage/number value: {value}");
169170
}

0 commit comments

Comments
 (0)