Skip to content

Commit be372a5

Browse files
committed
small fix
1 parent 1ac465a commit be372a5

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "obsidian-meta-bind-plugin",
33
"name": "Meta Bind Plugin",
4-
"version": "0.1.5",
4+
"version": "0.1.6",
55
"minAppVersion": "0.14.0",
66
"description": "This plugin can create input fields inside your notes and bind them to metadata fields.",
77
"author": "Moritz Jung",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-meta-bind-plugin",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"description": "This plugin can create input fields inside your notes and bind them to metadata fields.",
55
"main": "main.js",
66
"scripts": {

src/main.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ export default class MetaBindPlugin extends Plugin {
123123

124124
let fileContent: string = await this.app.vault.read(file);
125125
const regExp = new RegExp('^(---)\\n[\\s\\S]*\\n---');
126-
let frontMatter = regExp.exec(fileContent)[0];
127-
if (frontMatter === null) {
126+
let frontMatterRegExpResult = regExp.exec(fileContent);
127+
if (!frontMatterRegExpResult) {
128+
return {};
129+
}
130+
let frontMatter = frontMatterRegExpResult[0];
131+
if (!frontMatter) {
128132
return {};
129133
}
130134
// console.log(frontMatter);

0 commit comments

Comments
 (0)