jgauth / MMM-GoogleTasks

21 stars 26 forks source link

getDom gets number of tasks before checking if any tasks exists - throws NULL error #16

Open ruff-hi opened 2 years ago

ruff-hi commented 2 years ago

You need to move the numTasks line to the 'else' part of if any tasks statement.

getDom: function() {
    var wrapper = document.createElement('div');
    wrapper.className = "container ";
    wrapper.className += this.config.tableClass;

    if (!this.tasks) {
        wrapper.innerHTML = (this.loaded) ? "EMPTY" : "LOADING";
        wrapper.className = this.config.tableClass + " dimmed";
        return wrapper;
    } else {
        var numTasks = Object.keys(this.tasks).length;
    }