Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
ac316146
Commit
ac316146
authored
Mar 11, 2017
by
mrbean-bremen
Browse files
Prevent crashes on zero length segments or paths
- fixes __tiger.svg test image
parent
f9181931
Changes
3
Hide whitespace changes
Inline
Side-by-side
Source/Paths/SvgClosePathSegment.cs
View file @
ac316146
...
...
@@ -8,10 +8,15 @@ namespace Svg.Pathing
{
public
override
void
AddToPath
(
System
.
Drawing
.
Drawing2D
.
GraphicsPath
graphicsPath
)
{
if
(
graphicsPath
.
PointCount
==
0
)
{
return
;
}
// Important for custom line caps. Force the path the close with an explicit line, not just an implicit close of the figure.
var
pathPoints
=
graphicsPath
.
PathPoints
;
if
(
pathPoints
.
Length
>
0
&&
!
pathPoints
[
0
].
Equals
(
pathPoints
[
pathPoints
.
Length
-
1
]))
if
(!
pathPoints
[
0
].
Equals
(
pathPoints
[
pathPoints
.
Length
-
1
]))
{
var
pathTypes
=
graphicsPath
.
PathTypes
;
int
i
=
pathPoints
.
Length
-
1
;
...
...
Source/Paths/SvgLineSegment.cs
View file @
ac316146
...
...
@@ -15,7 +15,10 @@ namespace Svg.Pathing
public
override
void
AddToPath
(
System
.
Drawing
.
Drawing2D
.
GraphicsPath
graphicsPath
)
{
graphicsPath
.
AddLine
(
this
.
Start
,
this
.
End
);
if
(
this
.
Start
!=
this
.
End
)
{
graphicsPath
.
AddLine
(
this
.
Start
,
this
.
End
);
}
}
public
override
string
ToString
()
...
...
Source/Paths/SvgMoveToSegment.cs
View file @
ac316146
...
...
@@ -15,7 +15,10 @@ namespace Svg.Pathing
public
override
void
AddToPath
(
System
.
Drawing
.
Drawing2D
.
GraphicsPath
graphicsPath
)
{
graphicsPath
.
StartFigure
();
if
(
this
.
Start
!=
this
.
End
)
{
graphicsPath
.
StartFigure
();
}
}
public
override
string
ToString
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment