y-takey / atom-mermaid

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

Uncaught TypeError: Cannot read property '2' of null #51

Closed pjHealthQ closed 6 years ago

pjHealthQ commented 6 years ago

[Enter steps to reproduce:]

  1. Copy past example code into atom
  2. Right click "save as PNG"

There seems to be an issue in general with subgraphs and atom. They do not render properly. Example Code

graph TB
    c1-->a2
    subgraph one
    a1-->a2
    end
    subgraph two
    b1-->b2
    end
    subgraph three
    c1-->c2
    end

Atom: 1.26.1 x64 Electron: 1.7.11 OS: Mac OS X 10.12.6 Thrown From: atom-mermaid package 3.2.4

Stack Trace

Uncaught TypeError: Cannot read property '2' of null

At /Users/PJC/.atom/packages/atom-mermaid/lib/mermaid-view.coffee:195

TypeError: Cannot read property '2' of null
    at /packages/atom-mermaid/lib/mermaid-view.coffee:195:37)

Commands

  3x -0:41.7.0 core:move-down (input.hidden-input)
  2x -0:40.9.0 core:move-up (input.hidden-input)
     -0:40.4.0 editor:select-to-end-of-line (input.hidden-input)
     -0:40.1.0 core:backspace (input.hidden-input)
  2x -0:39.8.0 core:move-down (input.hidden-input)
     -0:39.4.0 editor:select-to-end-of-line (input.hidden-input)
     -0:39.2.0 core:backspace (input.hidden-input)
     -0:38.9.0 core:move-down (input.hidden-input)
     -0:38.7.0 editor:select-to-end-of-line (input.hidden-input)
     -0:38.4.0 core:backspace (input.hidden-input)
  2x -0:38.1.0 core:move-down (input.hidden-input)
     -0:37.8.0 editor:select-to-end-of-line (input.hidden-input)
     -0:37.6.0 core:backspace (input.hidden-input)
  7x -0:31.2.0 core:undo (input.hidden-input)
     -0:28.4.0 core:paste (input.hidden-input)
     -0:03.1.0 atom-mermaid:save-as-png (div.atom-mermaid-preview.native-key-bindings)

Non-Core Packages

atom-mermaid 3.2.4 
Hydrogen 0.9.0 
language-modelica3 0.0.0 
modelica undefined 
y-takey commented 6 years ago

Hi @pjHealthQ , thanks for your report :)

I've upgraded mermaid to v8.0.0, then the issue is fixed. (also #52) Could you retry after update your atom-mermaid 3.3.0?

pjHealthQ commented 6 years ago

Thank you y-takey

I had to delete and reinstall Atom for some reason yesterday (kept on crashing) — but after a reinstall and installing atom-mermaid v3.3.1 the problem was fixed.

Appreciate the help.

JC