Commit 47382ffe authored by Furry Futtock's avatar Furry Futtock
Browse files

Fixed stack overflow due to recursion.

parent 2bba3e4e
...@@ -13,13 +13,14 @@ namespace Svg ...@@ -13,13 +13,14 @@ namespace Svg
[SvgElement("polyline")] [SvgElement("polyline")]
public class SvgPolyline : SvgPolygon public class SvgPolyline : SvgPolygon
{ {
private GraphicsPath _Path;
public override GraphicsPath Path public override GraphicsPath Path
{ {
get get
{ {
if (Path == null || this.IsPathDirty) if (_Path == null || this.IsPathDirty)
{ {
Path = new GraphicsPath(); _Path = new GraphicsPath();
try try
{ {
...@@ -28,13 +29,13 @@ namespace Svg ...@@ -28,13 +29,13 @@ namespace Svg
PointF endPoint = new PointF(Points[i].ToDeviceValue(this), Points[i + 1].ToDeviceValue(this)); PointF endPoint = new PointF(Points[i].ToDeviceValue(this), Points[i + 1].ToDeviceValue(this));
// TODO: Remove unrequired first line // TODO: Remove unrequired first line
if (Path.PointCount == 0) if (_Path.PointCount == 0)
{ {
Path.AddLine(endPoint, endPoint); _Path.AddLine(endPoint, endPoint);
} }
else else
{ {
Path.AddLine(Path.GetLastPoint(), endPoint); _Path.AddLine(_Path.GetLastPoint(), endPoint);
} }
} }
} }
...@@ -44,7 +45,7 @@ namespace Svg ...@@ -44,7 +45,7 @@ namespace Svg
} }
this.IsPathDirty = false; this.IsPathDirty = false;
} }
return Path; return _Path;
} }
} }
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment