Chromium Code Reviews| Index: chrome/browser/resources/settings/controls/settings_checkbox.js |
| diff --git a/chrome/browser/resources/settings/controls/settings_checkbox.js b/chrome/browser/resources/settings/controls/settings_checkbox.js |
| index e892fb96f4558da4cc6a74c347366da705ffc505..d0bbebc2507522effac0b694d9548d7ad596280c 100644 |
| --- a/chrome/browser/resources/settings/controls/settings_checkbox.js |
| +++ b/chrome/browser/resources/settings/controls/settings_checkbox.js |
| @@ -87,7 +87,16 @@ Polymer({ |
| * @private |
| */ |
| checkedChanged_: function() { |
| - this.set('pref.value', this.getNewValue_(this.checked)); |
| + if (!this.pref) |
| + return; |
| + /** @type {boolean} */ var newValue = this.getNewValue_(this.checked); |
|
michaelpg
2015/12/02 18:54:50
looks like @type is redundant with @return of getN
stevenjb
2015/12/02 18:59:02
It is. I added it strictly as a comment to remind
|
| + // Ensure that newValue is the correct type for the pref type, either |
| + // a boolean or a number. |
| + if (this.pref.type == chrome.settingsPrivate.PrefType.NUMBER) { |
| + this.set('pref.value', newValue ? 1 : 0); |
| + return; |
| + } |
| + this.set('pref.value', newValue); |
| }, |
| /** |