Skip to content

Commit

Permalink
fix(list): adapt list cases to avoid array out of boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
jiawei686 authored and humyfred committed Jan 20, 2022
1 parent 391a09c commit 4061e50
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/core/hooks/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,11 @@ export default class List extends ParagraphBase {
return html + subTree;
}, '');

return (
html +
this.renderSubTree(node, children.slice(from, children.length), this.tree[children[children.length - 1]].type)
);
const childrenHtml = children.length
? this.renderSubTree(node, children.slice(from, children.length), this.tree[children[children.length - 1]].type)
: '';

return html + childrenHtml;
}

toHtml(text, sentenceMakeFunc) {
Expand Down

0 comments on commit 4061e50

Please sign in to comment.