fix: resolve crash from undefined value in frontmatter

This commit is contained in:
DecafDev 2024-07-24 21:38:45 -06:00
parent f55cce9634
commit bf4ac7ee2a
2 changed files with 6 additions and 6 deletions

View file

@ -136,11 +136,6 @@ export const formatFileDataForRender = ({
}
}
const textProperties: FileTextProperties = loadTextProperties(
app,
fileFrontmatter
);
let imageUrl: string | null = null;
//Handle image extension
@ -168,6 +163,11 @@ export const formatFileDataForRender = ({
//Handle image in frontmatter
if (imageUrl === null && coverImageSource !== "off") {
const textProperties: FileTextProperties = loadTextProperties(
app,
fileFrontmatter
);
for (const property of textProperties) {
const { value } = property;
const uri = getURIForWikiLink(app, value, path);

View file

@ -21,7 +21,7 @@ export const loadTextProperties = (
for (const entry of Object.entries(frontmatter)) {
const [key, value] = entry;
if (value === null) {
if (value === undefined || value === null) {
continue;
}
const isTextProperty = allTextProperties.find((p) => p.name === key);