Add checks if tasks exist in maps before trying to access them
Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
parent
e26df26f78
commit
38b5c7fb6c
1 changed files with 14 additions and 0 deletions
|
@ -309,6 +309,11 @@ func convertTodoistToVikunja(sync *sync) (fullVikunjaHierachie []*models.Namespa
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, exists := tasks[i.ParentID]; !exists {
|
||||||
|
log.Debugf("[Todoist Migration] Could not find task %d in tasks map while trying to get resolve subtasks for task %d", i.ParentID, i.ID)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Prevent all those nil errors
|
// Prevent all those nil errors
|
||||||
if tasks[i.ParentID].RelatedTasks == nil {
|
if tasks[i.ParentID].RelatedTasks == nil {
|
||||||
tasks[i.ParentID].RelatedTasks = make(models.RelatedTaskMap)
|
tasks[i.ParentID].RelatedTasks = make(models.RelatedTaskMap)
|
||||||
|
@ -332,6 +337,11 @@ func convertTodoistToVikunja(sync *sync) (fullVikunjaHierachie []*models.Namespa
|
||||||
// Task Notes -> Task Descriptions
|
// Task Notes -> Task Descriptions
|
||||||
// FIXME: Should be comments
|
// FIXME: Should be comments
|
||||||
for _, n := range sync.Notes {
|
for _, n := range sync.Notes {
|
||||||
|
if _, exists := tasks[n.ItemID]; !exists {
|
||||||
|
log.Debugf("[Todoist Migration] Could not find task %d for note %d", n.ItemID, n.ID)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if tasks[n.ItemID].Description != "" {
|
if tasks[n.ItemID].Description != "" {
|
||||||
tasks[n.ItemID].Description += "\n"
|
tasks[n.ItemID].Description += "\n"
|
||||||
}
|
}
|
||||||
|
@ -391,6 +401,10 @@ func convertTodoistToVikunja(sync *sync) (fullVikunjaHierachie []*models.Namespa
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, exists := tasks[r.ItemID]; !exists {
|
||||||
|
log.Debugf("Could not find task %d for reminder %d while trying to resolve reminders", r.ItemID, r.ID)
|
||||||
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
var date time.Time
|
var date time.Time
|
||||||
date, err = time.Parse("2006-01-02T15:04:05Z", r.Due.Date)
|
date, err = time.Parse("2006-01-02T15:04:05Z", r.Due.Date)
|
||||||
|
|
Loading…
Add table
Reference in a new issue