From 46cfbdfd365035bc5d6130cf61a8481a72767005 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 18 Aug 2023 12:55:07 +0200 Subject: [PATCH] don't cast blindly --- src/view.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/view.ts b/src/view.ts index 95c6837..68f3e08 100644 --- a/src/view.ts +++ b/src/view.ts @@ -17,7 +17,9 @@ export class JSPView extends ItemView { let content = this.contentEl.createDiv({cls: "just-share-please-view"}); if (this.plugin.settings.shared.length > 0) { for (let shared of this.plugin.settings.shared) { - let file = this.plugin.app.vault.getAbstractFileByPath(shared.path) as TFile; + let file = this.plugin.app.vault.getAbstractFileByPath(shared.path) ; + if(!(file instanceof TFile)) + continue; let div = content.createDiv({cls: "just-share-please-shared-item"}); div.createSpan({cls: "just-share-please-shared-name", text: removeExtension(shared.path).split(/[/\\]/g).pop()}); if (file?.path.match(/[/\\]/))