Merge "Prevent JSON parsing errors"

This commit is contained in:
jenkins-bot
2014-02-11 08:27:23 +00:00
committed by Gerrit Code Review

View File

@@ -180,8 +180,15 @@
this.preferences = preferenceStore().get( this.preferenceName );
} else {
var options = mw.user.options.get( this.preferenceName );
this.preferences = JSON.parse( options );
// Try to parse JSON
try {
this.preferences = JSON.parse( options );
} catch ( e ) {
this.preferences = {};
}
}
this.preferences = this.preferences || {};
},