diff --git a/src/main.ts b/src/main.ts index e1db728c..b190e233 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1251,7 +1251,7 @@ export default class ObsidianGit extends Plugin { this.app.workspace.iterateAllLeaves((leaf) => { if ( leaf.view instanceof MarkdownView && - (leaf.view.file as any).path == file.path + leaf.view.file?.path == file.path ) { leaf.detach(); }