Parcourir la source

prevent error when offsetting an empty list of polygon

ncannasse il y a 8 ans
Parent
commit
c6269fd67e
1 fichiers modifiés avec 2 ajouts et 0 suppressions
  1. 2 0
      h2d/col/IPolygons.hx

+ 2 - 0
h2d/col/IPolygons.hx

@@ -46,6 +46,8 @@ abstract IPolygons(Array<IPolygon>) from Array<IPolygon> to Array<IPolygon> {
 	}
 
 	public function offset( delta : Float, kind : IPolygon.OffsetKind, withHoles = true ) : IPolygons {
+		if( this.length == 0 )
+			return new IPolygons();
 		var c = new hxd.clipper.Clipper.ClipperOffset();
 		switch( kind ) {
 		case Square: