File tree 2 files changed +2
-2
lines changed
src/common/commontypes/geometry
2 files changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ export class LinearRing extends LineString {
43
43
components = [ components ] ;
44
44
}
45
45
let len = components . length ;
46
- if ( components [ 0 ] . equals ( components [ components . length - 1 ] ) ) {
46
+ if ( len > 1 && components [ 0 ] . equals ( components [ components . length - 1 ] ) ) {
47
47
len = components . length - 1 ;
48
48
}
49
49
for ( var i = 0 ; i < len ; i ++ ) {
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ describe('openlayers_Util', () => {
116
116
var lineString = polygon . components [ 0 ] ;
117
117
expect ( lineString instanceof LinearRing ) . toBeTruthy ( ) ;
118
118
expect ( lineString . components ) . not . toBeNull ( ) ;
119
- expect ( lineString . components . length ) . toBe ( 3 ) ;
119
+ expect ( lineString . components . length ) . toBe ( 4 ) ;
120
120
var point = lineString . components [ 0 ] ;
121
121
expect ( point instanceof Point ) . toBeTruthy ( ) ;
122
122
expect ( point . x ) . toBe ( - 2 ) ;
You can’t perform that action at this time.
0 commit comments