浏览代码

undef check

Ivan Asmer 4 年之前
父节点
当前提交
f9cfba16a2
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      index.mjs

+ 1 - 1
index.mjs

@@ -700,7 +700,7 @@ function toReact(ast, React, mapMDToComponents=defaultMapMDToComponents){
     const childToReact = child => typeof child === 'string' ?  child  : 
                                                                toReact(child, React, mapMDToComponents)
     const props = {key: Math.random(),
-                               children: ast.children.map(childToReact)}
+                               children: ast.children && ast.children.map(childToReact)}
     if (typeof RenderComponent !== 'string' && RenderComponent !== React.Fragment)
         Object.assign(props,{node: ast, 
                                title: ast.title && ast.title.map(childToReact),