Skip to content

Commit ef136f6

Browse files
committed
Polygon.setTo would fail if given an array of arrays as a list of points. Fix phaserjs#3619
1 parent 65c54f4 commit ef136f6

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
* Fix ParticleEmitter toJSON output, it was missing the `angle` property and the Emitter Ops were being cast wrong (thanks @samme)
4343
* Fixed loading normals with multi image load (thanks @iamchristopher)
4444
* Array.AddAt would fail if it branched to the fast-path within a Container due to an invalid property. Fix #3617 (thanks @poasher)
45+
* Polygon.setTo would fail if given an array of arrays as a list of points. Fix #3619 (thanks @PaulTodd)
4546

4647
### Examples, Documentation and TypeScript
4748

src/geom/polygon/Polygon.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ var Polygon = new Class({
9494
return this;
9595
}
9696

97-
var entry;
98-
var y0 = Number.MAX_VALUE;
9997
var p;
98+
var y0 = Number.MAX_VALUE;
10099

101100
// The points argument is an array, so iterate through it
102101
for (var i = 0; i < points.length; i++)
@@ -109,7 +108,7 @@ var Polygon = new Class({
109108
p.y = points[i + 1];
110109
i++;
111110
}
112-
else if (Array.isArray(entry))
111+
else if (Array.isArray(points[i]))
113112
{
114113
// An array of arrays?
115114
p.x = points[i][0];

0 commit comments

Comments
 (0)