فهرست منبع

prevent error when offsetting an empty list of polygon

ncannasse 8 سال پیش
والد
کامیت
c6269fd67e
1فایلهای تغییر یافته به همراه2 افزوده شده و 0 حذف شده
  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: