Skip to content

Commit 24e947c

Browse files
committed
fix a bug
1 parent b6f3f51 commit 24e947c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/core/src/hookConnect.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,12 @@ export const callSwitchChain = async (_chainId: string | number) => {
226226
} catch (error) {
227227
throw { code: UIERROR_CODE.ERROR_SWITCH_ETHEREUM }
228228
}
229-
if (Number(defaultNetwork) !== Number(await connectProvides?.usedWeb3?.eth?.getChainId())) {
229+
if (defaultNetwork && Number(defaultNetwork) !== Number(await connectProvides?.usedWeb3?.eth?.getChainId())) {
230230
throw { code: UIERROR_CODE.ERROR_SWITCH_ETHEREUM }
231231
}
232232
}
233233
}
234+
234235
export const useSelectNetwork = ({ className }: { className?: string }) => {
235236
const { t } = useTranslation()
236237
const { defaultNetwork: _defaultNetwork, isMobile } = useSettings()

0 commit comments

Comments
 (0)