Skip to content

Commit

Permalink
prevent error when no file open
Browse files Browse the repository at this point in the history
  • Loading branch information
brianpetro committed Jan 2, 2023
1 parent 98ba185 commit aff9344
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ class SmartConnectionsPlugin extends Obsidian.Plugin {

// runs when file is opened
this.registerEvent(this.app.workspace.on('file-open', (file) => {
// if no file is open, return
if(!file) {
// console.log("no file open, returning");
return;
}
// return if file type is not markdown
if(file.extension !== "md") {
// if file is 'canvas' and length of current view content is greater than 300 then return
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Smart Connections",
"author": "Brian Petro",
"description": "Find links to similar notes using artificial intelligence from OpenAI.",
"version": "1.0.16",
"version": "1.0.17",
"minAppVersion": "1.1.0",
"authorUrl": "https://wfhbrian.com",
"isDesktopOnly": true
Expand Down

0 comments on commit aff9344

Please sign in to comment.