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

All: Fixes #2088: Handle rare case when notebook has a parent that no longer exists, which causes a crash when sorting

This commit is contained in:
Laurent Cozic 2019-11-20 18:14:11 +00:00
parent 40753296c4
commit 4842f83aae

View File

@ -148,7 +148,11 @@ class Folder extends BaseItem {
for (let i = 0; i < folders.length; i++) {
if (folders[i].id === folder.parent_id) return folders[i];
}
throw new Error('Could not find parent');
// In some rare cases, some folders may not have a parent, for example
// if it has not been downloaded via sync yet.
// https://github.com/laurent22/joplin/issues/2088
return null;
};
const applyChildTimeToParent = folderId => {