From fe1e685f6f4f05afa30bd72d75a07ece925e4a10 Mon Sep 17 00:00:00 2001 From: Kire Date: Mon, 22 Mar 2021 10:37:56 -0400 Subject: [PATCH] fix(phone/twitter): Fix crash on broadcast with no profile set --- phone/src/apps/twitter/hooks/useTwitterNotifications.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phone/src/apps/twitter/hooks/useTwitterNotifications.ts b/phone/src/apps/twitter/hooks/useTwitterNotifications.ts index 046b35f..a754b20 100644 --- a/phone/src/apps/twitter/hooks/useTwitterNotifications.ts +++ b/phone/src/apps/twitter/hooks/useTwitterNotifications.ts @@ -36,7 +36,9 @@ export const useTwitterNotifications = () => { // defend against this case if (!profile) return; - const currentProfileName = profile.profile_name; + // Prevents a crash if there is no current profile + // set and a Twitter broadcast occurs. + const currentProfileName = profile?.profile_name; // we don't want notifications of our own tweets if (currentProfileName === profile_name) return;