From 4d198e46bc7dc5fa15adab7f488b707fefe7d338 Mon Sep 17 00:00:00 2001
From: Vendicated <vendicated@riseup.net>
Date: Fri, 5 Jan 2024 23:31:09 +0100
Subject: [PATCH] fix wrongly patching 'Events' context menu

---
 src/plugins/biggerStreamPreview/index.tsx | 2 +-
 src/plugins/copyUserURLs/index.tsx        | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/plugins/biggerStreamPreview/index.tsx b/src/plugins/biggerStreamPreview/index.tsx
index acad564d..40bbe30a 100644
--- a/src/plugins/biggerStreamPreview/index.tsx
+++ b/src/plugins/biggerStreamPreview/index.tsx
@@ -82,7 +82,7 @@ export const streamContextPatch: NavContextMenuPatchCallback = (children, { stre
 };
 
 export const userContextPatch: NavContextMenuPatchCallback = (children, { user }: UserContextProps) => {
-    return addViewStreamContext(children, { userId: user.id });
+    if (user) return addViewStreamContext(children, { userId: user.id });
 };
 
 export default definePlugin({
diff --git a/src/plugins/copyUserURLs/index.tsx b/src/plugins/copyUserURLs/index.tsx
index e3c336fb..9f69674c 100644
--- a/src/plugins/copyUserURLs/index.tsx
+++ b/src/plugins/copyUserURLs/index.tsx
@@ -30,6 +30,8 @@ interface UserContextProps {
 }
 
 const UserContextMenuPatch: NavContextMenuPatchCallback = (children, { user }: UserContextProps) => () => {
+    if (!user) return;
+
     children.push(
         <Menu.MenuItem
             id="vc-copy-user-url"