Skip to content

Commit 346aed2

Browse files
committed
Distinguish between Arrays and Objects when cloning in Cache.getJSON.
Fixes phaserjs#2551.
1 parent 0880380 commit 346aed2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/loader/Cache.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,8 @@ Phaser.Cache.prototype = {
13121312
{
13131313
if (clone)
13141314
{
1315-
return Phaser.Utils.extend(true, {}, data);
1315+
var base = Array.isArray(data) ? [] : {};
1316+
return Phaser.Utils.extend(true, base, data);
13161317
}
13171318
else
13181319
{

0 commit comments

Comments
 (0)