Properly handle wrong theme name

This commit is contained in:
Tyler Long 2018-03-15 22:44:00 +08:00
parent 2d560861df
commit 9913bf654b
2 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "mermaid",
"version": "8.0.0-beta.1",
"version": "8.0.0-beta.2",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
"main": "dist/mermaid.core.js",
"keywords": [

View File

@ -382,7 +382,10 @@ const render = function (id, txt, cb, container) {
const firstChild = svg.firstChild
// pre-defined theme
let style = config.theme !== undefined ? themes[config.theme] : ''
let style = themes[config.theme]
if (style === undefined) {
style = ''
}
// user provided theme CSS
if (config.themeCSS !== undefined) {
@ -441,7 +444,7 @@ const setConf = function (cnf) {
// Top level initially mermaid, gflow, sequenceDiagram and gantt
const lvl1Keys = Object.keys(cnf)
for (let i = 0; i < lvl1Keys.length; i++) {
if (typeof cnf[lvl1Keys[i]] === 'object') {
if (typeof cnf[lvl1Keys[i]] === 'object' && cnf[lvl1Keys[i]] != null) {
const lvl2Keys = Object.keys(cnf[lvl1Keys[i]])
for (let j = 0; j < lvl2Keys.length; j++) {