Skip to content

Conversation

@solotop999
Copy link

Summary

This PR fixes a potential runtime error in getFHECounterByChainId inside useFHECounter.tsx.

Previously, the code checked for "address" in entry without verifying whether entry was defined.
If FHECounterAddresses[chainId] returned undefined, it would throw: TypeError: Cannot use 'in' operator to search for 'address' in undefined

Changes

  • Updated the condition to safely check entry?.address before accessing it.
  • Prevents crashes when entry is undefined (e.g., when a chainId is not in FHECounterAddresses).

Before:

if (!("address" in entry) || entry.address === ethers.ZeroAddress) {
  return { abi: FHECounterABI.abi, chainId };
}

After:

if (!entry?.address || entry.address === ethers.ZeroAddress) {
  return { abi: FHECounterABI.abi, chainId };
}

@vercel
Copy link

vercel bot commented Sep 18, 2025

Someone is attempting to deploy a commit to the ZamaLabs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant