Merge "Prevent JSON parsing errors"
This commit is contained in:
@@ -180,8 +180,15 @@
|
|||||||
this.preferences = preferenceStore().get( this.preferenceName );
|
this.preferences = preferenceStore().get( this.preferenceName );
|
||||||
} else {
|
} else {
|
||||||
var options = mw.user.options.get( this.preferenceName );
|
var options = mw.user.options.get( this.preferenceName );
|
||||||
|
|
||||||
|
// Try to parse JSON
|
||||||
|
try {
|
||||||
this.preferences = JSON.parse( options );
|
this.preferences = JSON.parse( options );
|
||||||
|
} catch ( e ) {
|
||||||
|
this.preferences = {};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.preferences = this.preferences || {};
|
this.preferences = this.preferences || {};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user