Skip to content
Permalink
Browse files

fix($core): throw error when toc's length is 1

TypeError: Cannot read property 'depth' of undefined
  • Loading branch information...
ulivz committed Feb 11, 2019
1 parent 92f59b8 commit df4e48cf0934e465c3647ca4871abd0105dc8328
Showing with 8 additions and 0 deletions.
  1. +8 −0 lib/toc.js
@@ -19,6 +19,14 @@ module.exports = {
*/

function getSidebarByToc(toc) {
if (toc.length === 1) {
return [{
path: toc[0].slug,
title: toc[0].title,
collapsable: false
}]
}

const stack = new Stack()
const sidebar = []
stack.push({

0 comments on commit df4e48c

Please sign in to comment.
You can’t perform that action at this time.