From 6114af4f933f3cf82d203bd6b75680a972eac879 Mon Sep 17 00:00:00 2001
From: GyDi <zzzgydi@gmail.com>
Date: Thu, 18 May 2023 20:02:46 +0800
Subject: [PATCH] fix: profile data undefined error, close #566

---
 src/hooks/use-profiles.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/hooks/use-profiles.ts b/src/hooks/use-profiles.ts
index 9b49df2..4ecd772 100644
--- a/src/hooks/use-profiles.ts
+++ b/src/hooks/use-profiles.ts
@@ -32,7 +32,7 @@ export const useProfiles = () => {
     if (!profileData || !proxiesData) return;
 
     const current = profileData.items?.find(
-      (e) => e.uid === profileData.current
+      (e) => e && e.uid === profileData.current
     );
 
     if (!current) return;
@@ -70,7 +70,7 @@ export const useProfiles = () => {
 
   return {
     profiles,
-    current: profiles?.items?.find((p) => p.uid === profiles.current),
+    current: profiles?.items?.find((p) => p && p.uid === profiles.current),
     activateSelected,
     patchProfiles,
     patchCurrent,
-- 
GitLab