phibr0 / obsidian-dictionary

Dictionary - Obsidian Plugin | This plugin adds a multilingual dictionary to the Obsidian note taking tool.
GNU Affero General Public License v3.0
365 stars 45 forks source link

[Bug]: Error when closing all open leafs #56

Closed mgmeyers closed 2 years ago

mgmeyers commented 3 years ago

Describe the bug

When I close all open markdown files, this error is thrown:

Screen Shot 2021-10-07 at 5 44 13 PM

For the most part, this error doesn't cause any issues, but it will prevent Kanban boards from cleaning up after themselves if they are the last leaf to close.

Relevant errors (if available)

Uncaught (in promise) TypeError: Cannot read property 'path' of null
    at t.getFileCache (app.js:1)
    at _t.eval (eval at <anonymous> (app.js:1), <anonymous>:35:4930)
    at Generator.next (<anonymous>)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:6:982)
    at new Promise (<anonymous>)
    at _ (eval at <anonymous> (app.js:1), <anonymous>:6:802)
    at eval (eval at <anonymous> (app.js:1), <anonymous>:35:4832)
    at t.e.tryTrigger (app.js:1)
    at t.e.trigger (app.js:1)
    at t.trigger (app.js:1)
t.getFileCache @ app.js:1
eval @ VM219:35
eval @ VM219:6
_ @ VM219:6
eval @ VM219:35
e.tryTrigger @ app.js:1
e.trigger @ app.js:1
t.trigger @ app.js:1
t.activeLeafEvents @ app.js:1
a @ app.js:1
setTimeout (async)
l @ app.js:1
t.setActiveLeaf @ app.js:1
t.onLayoutChange @ app.js:1
t.insertChild @ app.js:1
t.createLeafInParent @ app.js:1
t.onLayoutChange @ app.js:1
t.removeChild @ app.js:1
t.detach @ app.js:1
t.detach @ app.js:1
eval @ VM173:71
o @ VM173:23
(anonymous) @ app.js:1
(anonymous) @ app.js:1

Steps to reproduce

Open a single markdown file and close it so that the No file is open message appears.

Expected Behavior

No response

Addition context

No response

Language

No response

API Name

No response

Operating system

macOS

phibr0 commented 2 years ago

Looks like the File-Open event on workspace may fire with a file of null. Will add a check for that later.