From 5d1c6d1e0cd02b9b417a8b70e1c82874d6ace34f Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Thu, 17 Apr 2025 23:30:08 -0600 Subject: [PATCH] fedimbed: forgot a null check --- src/modules/fedimbed.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index d375bf5..b4b1ab1 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -1485,10 +1485,12 @@ async function processUrl(msg, url, spoiler = false, command = false) { const newHandle = author.handle.split("@")[0]; user = `${author.name} (@${newHandle})`; - const contextHandle = context.match(/\(([^@]+?@.+?)\)/)?.[1]; - if (contextHandle) { - const newContextHandle = "@" + contextHandle.split("@")[0]; - context = context.replace(contextHandle, newContextHandle); + if (context) { + const contextHandle = context.match(/\(([^@]+?@.+?)\)/)?.[1]; + if (contextHandle) { + const newContextHandle = "@" + contextHandle.split("@")[0]; + context = context.replace(contextHandle, newContextHandle); + } } }