Handle corrupted values in input preferences
Bug: T246370 Change-Id: I13c730a6d584ad2f73807e11d5ceadfcb16a6040
This commit is contained in:
committed by
Nikerabbit
parent
207c5e6a9e
commit
4fc7bc9200
@@ -84,6 +84,19 @@
|
|||||||
|
|
||||||
load: function () {
|
load: function () {
|
||||||
this.registry = inputPreferences.get( 'ime' ) || this.registry;
|
this.registry = inputPreferences.get( 'ime' ) || this.registry;
|
||||||
|
// Some validation in case the stored preferences are corrupt
|
||||||
|
if ( typeof this.registry.language !== 'string' ) {
|
||||||
|
this.registry.language = null;
|
||||||
|
}
|
||||||
|
if ( !Array.isArray( this.registry.previousLanguages ) ) {
|
||||||
|
this.registry.previousLanguages = [];
|
||||||
|
}
|
||||||
|
if ( !Array.isArray( this.registry.previousInputMethods ) ) {
|
||||||
|
this.registry.previousInputMethods = [];
|
||||||
|
}
|
||||||
|
if ( !$.isPlainObject( this.registry.imes ) ) {
|
||||||
|
this.registry.imes = {};
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
disable: function () {
|
disable: function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user