@@ -76,13 +76,21 @@ private InternalPath(PointData[] points, bool isClosedPath)
7676 this . points = points ;
7777 this . closedPath = isClosedPath ;
7878
79- float minX = this . points . Min ( x => x . Point . X ) ;
80- float maxX = this . points . Max ( x => x . Point . X ) ;
81- float minY = this . points . Min ( x => x . Point . Y ) ;
82- float maxY = this . points . Max ( x => x . Point . Y ) ;
79+ if ( this . points . Length > 0 )
80+ {
81+ float minX = this . points . Min ( x => x . Point . X ) ;
82+ float maxX = this . points . Max ( x => x . Point . X ) ;
83+ float minY = this . points . Min ( x => x . Point . Y ) ;
84+ float maxY = this . points . Max ( x => x . Point . Y ) ;
8385
84- this . Bounds = new RectangleF ( minX , minY , maxX - minX , maxY - minY ) ;
85- this . Length = this . points . Sum ( x => x . Length ) ;
86+ this . Bounds = new RectangleF ( minX , minY , maxX - minX , maxY - minY ) ;
87+ this . Length = this . points . Sum ( x => x . Length ) ;
88+ }
89+ else
90+ {
91+ this . Bounds = RectangleF . Empty ;
92+ this . Length = 0 ;
93+ }
8694 }
8795
8896 /// <summary>
@@ -684,10 +692,14 @@ private static PointData[] Simplify(IEnumerable<ILineSegment> segments, bool isC
684692 private static PointData [ ] Simplify ( IEnumerable < PointF > vectors , bool isClosed )
685693 {
686694 PointF [ ] points = vectors . ToArray ( ) ;
687- var results = new List < PointData > ( ) ;
688695
689696 int polyCorners = points . Length ;
697+ if ( polyCorners == 0 )
698+ {
699+ return Array . Empty < PointData > ( ) ;
700+ }
690701
702+ var results = new List < PointData > ( ) ;
691703 Vector2 lastPoint = points [ 0 ] ;
692704
693705 if ( ! isClosed )
0 commit comments