handle case where the data from the resolver is empty (#963)
* handle case where the data from the resolver is empty * is_empty instead of 0 comparison
This commit is contained in:
parent
f1eaee52ef
commit
7afde0ca0a
|
@ -1139,6 +1139,11 @@ impl<P: JsonRpcClient> Provider<P> {
|
|||
// the call will return a Bytes array which we convert to an address
|
||||
let data = self.call(&ens::get_resolver(ens_addr, ens_name).into(), None).await?;
|
||||
|
||||
// otherwise, decode_bytes panics
|
||||
if data.0.is_empty() {
|
||||
return Err(ProviderError::EnsError(ens_name.to_owned()))
|
||||
}
|
||||
|
||||
let resolver_address: Address = decode_bytes(ParamType::Address, data);
|
||||
if resolver_address == Address::zero() {
|
||||
return Err(ProviderError::EnsError(ens_name.to_owned()))
|
||||
|
|
Loading…
Reference in New Issue