Skip to content

Commit

Permalink
Use JSON.parse in AssetManager only if the value is a string. Closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Jul 5, 2017
1 parent 2c7de13 commit 5f5ba1a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/asset_manager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,13 @@ module.exports = () => {
var name = this.storageKey;
if(!d && c.stm)
d = c.stm.load(name);
var assets = [];
var assets = d[name] || [];

try{
assets = JSON.parse(d[name]);
}catch(err){}
if (typeof assets == 'string') {
try {
assets = JSON.parse(d[name]);
} catch(err) {}
}

if (assets && assets.length) {
this.getAll().reset(assets);
Expand Down

0 comments on commit 5f5ba1a

Please sign in to comment.