y-takey / atom-mermaid

Preview mermaid on atom editor
MIT License
42 stars 7 forks source link

Uncaught TypeError: Cannot read property '0' of undefined #1

Closed JasonGao180 closed 9 years ago

JasonGao180 commented 9 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.0.0 System: Mac OS X 10.10.4 Thrown From: atom-mermaid package, v0.1.0

Stack Trace

Uncaught TypeError: Cannot read property '0' of undefined

At /Applications/Atom.app/Contents/Resources/app.asar/node_modules/q/q.js:128

TypeError: Cannot read property '0' of undefined
    at Object.parse (/Users/JasonGao/working/repo/atom-mermaid/node_modules/mermaid/src/diagrams/flowchart/parser/flow.js:363:19)
    at Object.exports.getClasses (/Users/JasonGao/working/repo/atom-mermaid/node_modules/mermaid/src/diagrams/flowchart/flowRenderer.js:209:12)
    at render (/Users/JasonGao/working/repo/atom-mermaid/node_modules/mermaid/src/mermaidAPI.js:168:40)
    at Object.exports.render (/Users/JasonGao/working/repo/atom-mermaid/node_modules/mermaid/src/mermaidAPI.js:221:9)
    at init (/Users/JasonGao/working/repo/atom-mermaid/node_modules/mermaid/src/mermaid.js:81:20)
    at Object.global.mermaid.init (/Users/JasonGao/working/repo/atom-mermaid/node_modules/mermaid/src/mermaid.js:116:14)
    at MermaidView.module.exports.MermaidView.MermaidView.renderHTMLCode (/Users/JasonGao/working/repo/atom-mermaid/lib/mermaid-view.coffee:164:17)
    at MermaidView.module.exports.MermaidView.MermaidView.renderHTML (/Users/JasonGao/working/repo/atom-mermaid/lib/mermaid-view.coffee:153:23)
    at /Users/JasonGao/working/repo/atom-mermaid/lib/atom-mermaid.coffee:78:23
    at _fulfilled (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/q/q.js:794:54)

Commands

Config

{
  "core": {
    "themes": [
      "atom-dark-ui",
      "atom-dark-syntax"
    ]
  }
}

Installed Packages

# User
atom-mermaid, v0.1.0
markdown-preview, v0.150.0
markdown-preview-opener, v0.1.1
markdown-scroll-sync, v0.4.0
markdown-table-formatter, v2.5.2
pretty-json, v0.4.1
vim-mode, v0.54.0

# Dev
No dev packages
y-takey commented 9 years ago

@JasonGao180 Thanks for bug report!

I have 2 questions.

  1. Please tell me step1 & 2 of steps to reproduce below. That looks like "..."
  2. When did you use the installed package? I pushed latest version to github yesterday. then published to package registry just now. Sorry, I didn't increase the version number, because it was before the public.
vmuriart commented 9 years ago

Going to piggy back on this thread since i just had the same error and just installed it 5 minutes ago To replicate I did the following:

  1. Open a blank file
  2. Run mermaid previewer Errors with empty the empty file.

If instead you do:

  1. Open blank file
  2. Type in chart code
  3. Run Mermaid Previewer It produces no error. BUT if you continue to do:
  4. delete everything in the file Now it will produce the error again without having to rerun it.

Seems the error happens due to there being nothing to use for the previewer.

y-takey commented 9 years ago

@vmuriart Thanks for report. I fixed it, and published the package latest version. Please again to try it.