Merge "Platform: Handle invalid JSON in the other path in #getUserConfig"

This commit is contained in:
jenkins-bot 2022-11-06 22:47:50 +00:00 committed by Gerrit Code Review
commit a46d76bc1e

View file

@ -116,14 +116,19 @@ ve.init.mw.Platform.prototype.getUserConfig = function ( keys ) {
var values = mw.user.options.get( keys );
var parsedValues = {};
Object.keys( values ).forEach( function ( value ) {
parsedValues[ value ] = JSON.parse( values[ value ] );
try {
parsedValues[ value ] = JSON.parse( values[ value ] );
} catch ( e ) {
// We might encounter corrupted values in the store
parsedValues[ value ] = null;
}
} );
return parsedValues;
} else {
try {
return JSON.parse( mw.user.options.get( keys ) );
} catch ( e ) {
// We might encounter an old unencoded value in the store
// We might encounter corrupted values in the store
return null;
}
}