Browse Source

prevent error when offsetting an empty list of polygon

ncannasse 8 năm trước cách đây
mục cha
commit
c6269fd67e
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  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: