fix: handle missing 'providers' field

This commit is contained in:
Memory 2025-11-10 09:07:47 +08:00 committed by GitHub
parent 4af5cae356
commit 8ebe99a8ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ const ProxyProvider: React.FC = () => {
const { data, mutate } = useSWR('mihomoProxyProviders', mihomoProxyProviders)
const providers = useMemo(() => {
if (!data) return []
if (!data || !data.providers) return []
return Object.values(data.providers)
.filter((provider) => provider.vehicleType !== 'Compatible')
.sort((a, b) => {

View File

@ -49,7 +49,7 @@ const RuleProvider: React.FC = () => {
const { data, mutate } = useSWR('mihomoRuleProviders', mihomoRuleProviders)
const providers = useMemo(() => {
if (!data) return []
if (!data || !data.providers) return []
return Object.values(data.providers).sort((a, b) => {
if (a.vehicleType === 'File' && b.vehicleType !== 'File') {
return -1