Browse Source

prevent error when offsetting an empty list of polygon

ncannasse 8 years ago
parent
commit
c6269fd67e
1 changed files with 2 additions and 0 deletions
  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: