@@ -145,11 +145,13 @@ export class ChainShape extends Shape {
145145 return ;
146146 }
147147
148- for ( let i = 1 ; i < vertices . length ; ++ i ) {
149- const v1 = vertices [ i - 1 ] ;
150- const v2 = vertices [ i ] ;
151- // If the code crashes here, it means your vertices are too close together.
152- if ( _ASSERT ) console . assert ( Vec2 . distanceSquared ( v1 , v2 ) > Settings . linearSlopSquared ) ;
148+ if ( _ASSERT ) {
149+ for ( let i = 1 ; i < vertices . length ; ++ i ) {
150+ const v1 = vertices [ i - 1 ] ;
151+ const v2 = vertices [ i ] ;
152+ // If the code crashes here, it means your vertices are too close together.
153+ console . assert ( Vec2 . distanceSquared ( v1 , v2 ) > Settings . linearSlopSquared ) ;
154+ }
153155 }
154156
155157 this . m_vertices = [ ] ;
@@ -175,11 +177,13 @@ export class ChainShape extends Shape {
175177 _createChain ( vertices : Vec2Value [ ] ) : ChainShape {
176178 if ( _ASSERT ) console . assert ( this . m_vertices . length == 0 && this . m_count == 0 ) ;
177179 if ( _ASSERT ) console . assert ( vertices . length >= 2 ) ;
178- for ( let i = 1 ; i < vertices . length ; ++ i ) {
179- const v1 = vertices [ i - 1 ] ;
180- const v2 = vertices [ i ] ;
181- // If the code crashes here, it means your vertices are too close together.
182- if ( _ASSERT ) console . assert ( Vec2 . distanceSquared ( v1 , v2 ) > Settings . linearSlopSquared ) ;
180+ if ( _ASSERT ) {
181+ for ( let i = 1 ; i < vertices . length ; ++ i ) {
182+ const v1 = vertices [ i - 1 ] ;
183+ const v2 = vertices [ i ] ;
184+ // If the code crashes here, it means your vertices are too close together.
185+ console . assert ( Vec2 . distanceSquared ( v1 , v2 ) > Settings . linearSlopSquared ) ;
186+ }
183187 }
184188
185189 this . m_vertices = [ ] ;
0 commit comments