mirror of
https://github.com/felvesthe/Note-Locker.git
synced 2026-07-22 05:44:06 +00:00
Check if file exists in toggleNoteLock
Signed-off-by: Felvesthe <23108389+Felvesthe@users.noreply.github.com>
This commit is contained in:
parent
1dde3618c7
commit
8c1788f259
1 changed files with 6 additions and 0 deletions
6
main.ts
6
main.ts
|
|
@ -67,6 +67,12 @@ export default class NoteLockerPlugin extends Plugin {
|
|||
await this.saveSettings();
|
||||
|
||||
const file = this.app.vault.getAbstractFileByPath(notePath);
|
||||
|
||||
if (!file) {
|
||||
new Notice("Error: Note not found");
|
||||
return;
|
||||
}
|
||||
|
||||
const fileName = file instanceof TFile ? file.basename :
|
||||
notePath.split('/').pop()?.replace(/\..+$/, '') || notePath;
|
||||
const displayName = this.truncateFileName(fileName);
|
||||
|
|
|
|||
Loading…
Reference in a new issue