From 1ce44c2d55fcf4f23cf293eedc1a47cdaba8a858 Mon Sep 17 00:00:00 2001 From: Zsolt Viczian Date: Thu, 30 Dec 2021 19:15:34 +0100 Subject: [PATCH] 1.5.11 fix for #327 --- manifest.json | 2 +- src/ExcalidrawData.ts | 2 ++ src/main.ts | 2 +- versions.json | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 9660325..3c5d7f2 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "1.5.10", + "version": "1.5.11", "minAppVersion": "0.12.16", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/src/ExcalidrawData.ts b/src/ExcalidrawData.ts index e01585e..d4f553f 100644 --- a/src/ExcalidrawData.ts +++ b/src/ExcalidrawData.ts @@ -210,6 +210,7 @@ export class ExcalidrawData { file: TFile, textMode: TextMode, ): Promise { + if(!file) return false; this.loaded = false; this.textElements = new Map< string, @@ -340,6 +341,7 @@ export class ExcalidrawData { } public async loadLegacyData(data: string, file: TFile): Promise { + if(!file) return false; this.compatibilityMode = true; this.file = file; this.textElements = new Map< diff --git a/src/main.ts b/src/main.ts index 0302966..9bc242a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1723,7 +1723,7 @@ export default class ExcalidrawPlugin extends Plugin { if (f.extension == "excalidraw") { return true; } - const fileCache = this.app.metadataCache.getFileCache(f); + const fileCache = f ? this.app.metadataCache.getFileCache(f) : null; return !!fileCache?.frontmatter && !!fileCache.frontmatter[FRONTMATTER_KEY]; } } diff --git a/versions.json b/versions.json index 6258c69..a1b8208 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,4 @@ { - "1.5.10": "0.12.16", + "1.5.11": "0.12.16", "1.4.2": "0.11.13" }