guard against null pointer exception

pull/1/head
ansuz 7 years ago
parent fb192a2c45
commit 8213d0d926

@ -70,6 +70,10 @@ define([
var makeCheckbox = function (id, cb) { var makeCheckbox = function (id, cb) {
var entry = APP.lm.proxy.data[id]; var entry = APP.lm.proxy.data[id];
if (!entry || typeof(entry) !== 'object') {
return void console.log('entry undefined');
}
var checked = entry.state === 1 ? var checked = entry.state === 1 ?
'cp-app-todo-task-checkbox-checked fa-check-square-o': 'cp-app-todo-task-checkbox-checked fa-check-square-o':
'cp-app-todo-task-checkbox-unchecked fa-square-o'; 'cp-app-todo-task-checkbox-unchecked fa-square-o';
@ -108,6 +112,9 @@ define([
.appendTo($taskDiv); .appendTo($taskDiv);
var entry = APP.lm.proxy.data[el]; var entry = APP.lm.proxy.data[el];
if (!entry || typeof(entry) !== 'object') {
return void console.log('entry undefined');
}
if (entry.state) { if (entry.state) {
$taskDiv.addClass('cp-app-todo-task-complete'); $taskDiv.addClass('cp-app-todo-task-complete');

Loading…
Cancel
Save