Panic if a TaskCollection.ReadAll does not return []*models.Task

This commit is contained in:
kolaente 2020-10-17 22:07:51 +02:00
parent 3abb3b471d
commit 891ae88c86
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 6 additions and 5 deletions

View File

@ -403,16 +403,17 @@ func (vcls *VikunjaCaldavListStorage) getListRessource(isCollection bool) (rr Vi
tk := models.TaskCollection{
ListID: vcls.list.ID,
}
var iface interface{}
iface, _, _, err = tk.ReadAll(vcls.user, "", 1, 1000)
iface, _, _, err := tk.ReadAll(vcls.user, "", 1, 1000)
if err != nil {
return
}
tasks, ok := iface.([]*models.Task)
if ok {
listTasks = tasks
vcls.list.Tasks = tasks
if !ok {
panic("Tasks returned from TaskCollection.ReadAll are not []*models.Task!")
}
listTasks = tasks
vcls.list.Tasks = tasks
}
rr = VikunjaListResourceAdapter{