org-roam / org-roam-ui

A graphical frontend for exploring your org-roam Zettelkasten
GNU General Public License v3.0
1.99k stars 109 forks source link

[BUG] accessing r.properties.ROAM_REFS causing client crash due to r.properties being null, caused by passing local variable that changes major-mode #318

Open hermanhel opened 4 months ago

hermanhel commented 4 months ago

Describe the bug Accessing r.properties.ROAM_REFS causing client crash due to r.properties being null. This can happen if you have put local varibles like following:

# Local Variables:
# mode: sh
# sh-shell: tcsh
# End:

in one of your org-roam note To Reproduce Which specific things did you do which lead to said bug? E.g. what did you click, which commands did you call, etc.

  1. add the
    
    # Local Variables:
    # mode: sh
    # sh-shell: tcsh
    # End:

to one of the org-roam note
2. call `org-roam-ui-mode`
3. see the crash in your openned browser, together with the error `cannot access r.properties.ROAM_REFS, r.properties is null`

**Expected behavior**
It should not crash the whole client. Maybe an empty note or an error message on screen like "WOW, an image", "WOW, no properties drawer".

**What browser were you using?**
Firefox

**Additional context**
This is does not affect [publish-org-roam-ui](https://github.com/ikoamu/publish-org-roam-ui)'s `local.sh`.

calling `(org-element-parse-buffer)` on an `sh-mode` buffer parses the properties alright.