preference: Only toggle the state if element is present.

Fixes #393.
This commit is contained in:
Priyank P
2018-01-22 12:08:01 -05:00
committed by Akash Nimare
parent c8d7a79877
commit aedd95259d

View File

@@ -77,13 +77,17 @@ class PreferenceView extends BaseComponent {
ipcRenderer.on('toggle-sidebar', (event, state) => {
const inputSelector = '#sidebar-option .action .switch input';
const input = document.querySelector(inputSelector);
input.checked = state;
if (input) {
input.checked = state;
}
});
ipcRenderer.on('toggletray', (event, state) => {
const inputSelector = '#tray-option .action .switch input';
const input = document.querySelector(inputSelector);
input.checked = state;
if (input) {
input.checked = state;
}
});
}
}