Skip to content

Commit e3e510c

Browse files
committed
fix: guard against null fields in Card external-link branch
The condition '!fields && !fields.slug' would throw a TypeError when fields is null/undefined because the second operand still accesses .slug on the falsy value. Use '(!fields || !fields.slug)' instead. Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
1 parent 91af28b commit e3e510c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/components/Card/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const Card = ({
7171
see more <IoIosArrowRoundForward />
7272
</Link>
7373
)}
74-
{!fields && !fields.slug && frontmatter.eurl && (
74+
{(!fields || !fields.slug) && frontmatter.eurl && (
7575
<a
7676
className="external-link-btn"
7777
href={frontmatter.eurl}

0 commit comments

Comments
 (0)