Skip to content

Commit

Permalink
fix: Fixed an issue that caused an error if Object was null for vfm
Browse files Browse the repository at this point in the history
  • Loading branch information
akabekobeko committed Jul 2, 2021
1 parent 43233a3 commit 38906f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/plugins/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ const readAttributesCollection = (
* @returns Settings.
*/
const readSettings = (data: any): VFMSettings => {
if (typeof data !== 'object') {
if (data === null || typeof data !== 'object') {
return { toc: false };
}

Expand Down
4 changes: 2 additions & 2 deletions tests/metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,10 @@ Text

it('Specify null or empty string for Object', () => {
const md = `---
html:
html: ''
meta:
-
vfm: ''
vfm:
---
`;
const received = stringify(md);
Expand Down

0 comments on commit 38906f0

Please sign in to comment.