Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
8ad92e3a
Commit
8ad92e3a
authored
8 years ago
by
Tebjan Halm
Committed by
GitHub
8 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #294 from mrbean-bremen/empty-path-crash
Prevent crashes on zero length segments or paths
parents
2a4bc179
ac316146
master
netstandard2
nuget2.4.2
nuget2.4.1
nuget2.4
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Source/Paths/SvgClosePathSegment.cs
+6
-1
Source/Paths/SvgClosePathSegment.cs
Source/Paths/SvgLineSegment.cs
+4
-1
Source/Paths/SvgLineSegment.cs
Source/Paths/SvgMoveToSegment.cs
+4
-1
Source/Paths/SvgMoveToSegment.cs
with
14 additions
and
3 deletions
+14
-3
Source/Paths/SvgClosePathSegment.cs
+
6
-
1
View file @
8ad92e3a
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
Source/Paths/SvgLineSegment.cs
+
4
-
1
View file @
8ad92e3a
...
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
Source/Paths/SvgMoveToSegment.cs
+
4
-
1
View file @
8ad92e3a
...
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help