From 346aed28661a069cf2865cb0b8b8b84fe3f3a355 Mon Sep 17 00:00:00 2001 From: David Hayes Date: Fri, 10 Jun 2016 10:33:05 -0500 Subject: [PATCH] Distinguish between Arrays and Objects when cloning in Cache.getJSON. Fixes #2551. --- src/loader/Cache.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/loader/Cache.js b/src/loader/Cache.js index 582034bac..86911c9eb 100644 --- a/src/loader/Cache.js +++ b/src/loader/Cache.js @@ -1312,7 +1312,8 @@ Phaser.Cache.prototype = { { if (clone) { - return Phaser.Utils.extend(true, {}, data); + var base = Array.isArray(data) ? [] : {}; + return Phaser.Utils.extend(true, base, data); } else {