tmp hotfix, people still have null tasks? `Cannot read property 'tags'

of undefined`
This commit is contained in:
Tyler Renelle
2013-09-09 09:12:00 -04:00
parent 1bcdcf8590
commit 2230b67857

View File

@@ -218,6 +218,7 @@ function transformTaskLists(doc) {
_.each(['habit', 'daily', 'todo', 'reward'], function(type) {
// we use _.transform instead of a simple _.where in order to maintain sort-order
doc[type + "s"] = _.reduce(doc[type + "Ids"], function(m, tid) {
if (!doc.tasks[tid]) return m; // FIXME tmp hotfix, people still have null tasks?
if (!doc.tasks[tid].tags) doc.tasks[tid].tags = {}; // FIXME remove this when we switch tasks to subdocs and can define tags default in schema
m.push(doc.tasks[tid]);
return m;