Explorar el Código

fix: profile data undefined error, close #566

GyDi hace 2 años
padre
commit
6114af4f93
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      src/hooks/use-profiles.ts

+ 2 - 2
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,