1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Mobile: Fixes #1068: Handle case where notebook has a parent that no longer exists

This commit is contained in:
Laurent Cozic 2018-12-31 17:33:20 +01:00
parent f308fe71f9
commit 30201249b5

View File

@ -166,10 +166,16 @@ class Folder extends BaseItem {
const folder = idToFolders[folderId];
if (!folder.parent_id) {
rootFolders.push(folder);
} else {
if (!idToFolders[folder.parent_id]) {
// It means the notebook is refering a folder that doesn't exist. In theory it shouldn't happen
// but sometimes does - https://github.com/laurent22/joplin/issues/1068#issuecomment-450594708
rootFolders.push(folder);
} else {
idToFolders[folder.parent_id].children.push(folder);
}
}
}
return rootFolders;
}