File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
src/PolylineAlgorithm/Abstraction Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ public Polyline Encode(IEnumerable<TCoordinate> coordinates) {
7474
7575 return builder . Build ( ) ;
7676
77- static int GetMaximumLength ( int count ) => count > 1 ? count * Defaults . Polyline . MaxEncodedCoordinateLength : int . MaxValue ;
77+ static int GetMaximumLength ( int count ) => ( count > 1 && count < int . MaxValue / Defaults . Polyline . MaxEncodedCoordinateLength ) ? count * Defaults . Polyline . MaxEncodedCoordinateLength : 64_000 ;
7878
7979 static ( int Latitude , int Longitude ) Normalize ( ( double Latitude , double Longitude ) coordinate ) =>
8080 ( PolylineEncoding . Default . Normalize ( coordinate . Latitude ) , PolylineEncoding . Default . Normalize ( coordinate . Longitude ) ) ;
@@ -91,6 +91,8 @@ public Polyline Encode(IEnumerable<TCoordinate> coordinates) {
9191 [ ExcludeFromCodeCoverage ]
9292 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
9393 static int GetCount ( IEnumerable < TCoordinate > coordinates ) => coordinates switch {
94+ TCoordinate [ ] array => array . Length ,
95+ List < TCoordinate > list => list . Count ,
9496 ICollection collection => collection . Count ,
9597 _ => - 1
9698 } ;
You can’t perform that action at this time.
0 commit comments