Unverified Commit f7c5fb06 authored by mrbean-bremen's avatar mrbean-bremen
Browse files

Handle special case where path consists of a single move command

- prevents crash, fixes #223
parent c409d2eb
...@@ -45,13 +45,27 @@ namespace Svg ...@@ -45,13 +45,27 @@ namespace Svg
{ {
if (this._path == null || this.IsPathDirty) if (this._path == null || this.IsPathDirty)
{ {
_path = new GraphicsPath(); this._path = new GraphicsPath();
foreach (SvgPathSegment segment in this.PathData) foreach (SvgPathSegment segment in this.PathData)
{ {
segment.AddToPath(_path); segment.AddToPath(_path);
} }
if (_path.PointCount == 0)
{
if (this.PathData.Count > 0)
{
// special case with one move command only, see #223
var segment = this.PathData.Last;
_path.AddLine(segment.End, segment.End);
this.Fill = SvgPaintServer.None;
}
else
{
_path = null;
}
}
this.IsPathDirty = false; this.IsPathDirty = false;
} }
return _path; return _path;
......
...@@ -181,6 +181,8 @@ __issue-191-01 ...@@ -181,6 +181,8 @@ __issue-191-01
__issue-202-01 __issue-202-01
__issue-214-01 __issue-214-01
__issue-215-01 __issue-215-01
__issue-223-01
__issue-223-02
__issue-227-01 __issue-227-01
__issue-227-02 __issue-227-02
__issue-239-01 __issue-239-01
......
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