kusold / todoist-habitrpg

One way sync from Todoist -> HabitRPG
120 stars 14 forks source link

JS error in habitSync.parseTodoistRepeatingDate #26

Closed mstave closed 9 years ago

mstave commented 9 years ago

/home/me/node-v0.10.35-linux-x86/lib/node_modules/todoist-habitrpg/habitSync.js:292 var noStartDate = !(dateString.match(/(after|starting|last|\d+(st|nd|rd|th)| ^ TypeError: Cannot call method 'match' of null at habitSync.parseTodoistRepeatingDate (/home/me/node-v0.10.35-linux-x86/lib/node_modules/todoist-habitrpg/habit Sync.js:292:34) at async.waterfall.history.tasks.(anonymous function).todoist (/home/me/node-v0.10.35-linux-x86/lib/node_modules /todoist-habitrpg/habitSync.js:154:29) at fn (/home/me/node-v0.10.35-linux-x86/lib/node_modules/todoist-habitrpg/node_modules/async/lib/async.js:641:34 ) at Object._onImmediate (/home/me/node-v0.10.35-linux-x86/lib/node_modules/todoist-habitrpg/node_modules/async/li b/async.js:557:34) at processImmediate as _immediateCallback

Here's 292:

habitSync.prototype.parseTodoistRepeatingDate = function(dateString) { var type = "todo"; var repeat;

var noStartDate = !(dateString.match(/(after|starting|last|\d+(st|nd|rd|th)|(first|second|third))/i));

mstave commented 9 years ago

I added some debug info to find the problem. It was on just one todoist task. Not sure what was special about it, it had no due date, so I added one and it fixed the problem. I have others without due date that work ok. This one may have been created with Google Now on Android, which perhaps doesn't initialize some date value. In any case, sounds like we need a check for null

crookedneighbor commented 9 years ago

Thanks for figuring it out.

@Kusold did you want to take care of this? Or re-open the issue so I remember to work on it when I have a chance?