mirror of
https://github.com/zadam/trilium.git
synced 2026-01-06 14:44:25 +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
|
// We are not the first child at this level so previous
|
||||||
// should go to the end of the previous tree
|
// should go to the end of the previous tree
|
||||||
let candidate = children[index - 1];
|
let candidate = children[index - 1];
|
||||||
while (candidate.hasVisibleChildren()) {
|
while (candidate?.hasVisibleChildren()) {
|
||||||
const children = candidate.getVisibleChildNotes();
|
const visibleChildren = candidate.getVisibleChildNotes();
|
||||||
const lastChild = children[children.length - 1];
|
|
||||||
candidate = lastChild;
|
if (visibleChildren.length === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
candidate = visibleChildren[visibleChildren.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return candidate;
|
return candidate ?? null;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
const nextNote = (() => {
|
const nextNote = (() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user