From 50b0e7a70ea71436468bed50306b3b648e6cd184 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Mon, 19 Jan 2026 21:55:28 +0100 Subject: [PATCH] fix: handle undefined/null input in stripHtmlTags function Adds null check to prevent crash when recipe name or description fields are undefined. --- src/lib/js/stripHtmlTags.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/js/stripHtmlTags.ts b/src/lib/js/stripHtmlTags.ts index 0ce64b6..aab2b2d 100644 --- a/src/lib/js/stripHtmlTags.ts +++ b/src/lib/js/stripHtmlTags.ts @@ -1,7 +1,10 @@ // Function to strip HTML tags from a string import {load} from 'cheerio'; -export function stripHtmlTags(input: string): string { +export function stripHtmlTags(input: string | undefined | null): string { + if (!input) { + return ''; + } const $ = load(input.replace(/­/g, '')); return $.text(); }