mirror of
https://github.com/zadam/trilium.git
synced 2025-12-31 03:34:23 +01:00
fix(share): Prevent crashing if candidate note is null (#8164)
This commit is contained in:
commit
758df0d85a
@ -15,13 +15,17 @@
|
||||
// We are not the first child at this level so previous
|
||||
// should go to the end of the previous tree
|
||||
let candidate = children[index - 1];
|
||||
while (candidate.hasVisibleChildren()) {
|
||||
const children = candidate.getVisibleChildNotes();
|
||||
const lastChild = children[children.length - 1];
|
||||
candidate = lastChild;
|
||||
while (candidate?.hasVisibleChildren()) {
|
||||
const visibleChildren = candidate.getVisibleChildNotes();
|
||||
|
||||
if (visibleChildren.length === 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
candidate = visibleChildren[visibleChildren.length - 1];
|
||||
}
|
||||
|
||||
return candidate;
|
||||
return candidate ?? null;
|
||||
})();
|
||||
|
||||
const nextNote = (() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user