mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-05-27 11:02:38 -05:00
Show popup error for corrupt teams
This commit is contained in:
parent
cc7af41bd5
commit
d41b7329b3
|
|
@ -31,7 +31,16 @@ Storage.loadTeams = function() {
|
|||
this.teams = [];
|
||||
if (window.localStorage) {
|
||||
var teamString = localStorage.getItem('showdown_teams');
|
||||
if (teamString) this.teams = JSON.parse(teamString);
|
||||
if (teamString) {
|
||||
try {
|
||||
this.teams = JSON.parse(teamString);
|
||||
} catch (e) {
|
||||
app.addPopup(Popup, {
|
||||
type: 'modal',
|
||||
htmlMessage: "Your teams are corrupt and could not be loaded. :( We may be able to recover a team from this data:<br /><textarea rows=\"10\" cols=\"60\">" + Tools.escapeHTML(teamString) + "</textarea>"
|
||||
});
|
||||
}
|
||||
}
|
||||
app.trigger('init:loadteams');
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user