fix(@embark/ens): don't break when determining contract addresses

Turns out that, when Embark tries to replace ENS subdomains, it would fail
if `subdomains` aren't defined in the namesystem configuration.

This commit adds a safeguard so that not defining `subdomains` is fine.
This commit is contained in:
Pascal Precht 2019-11-12 16:44:07 +01:00 committed by Pascal Precht
parent 3f4e12aa0f
commit 0d20cb5d86

View File

@ -180,7 +180,7 @@ class ENS {
return cb();
}
await Promise.all(Object.keys(this.config.namesystemConfig.register.subdomains).map((subDomainName) => {
await Promise.all(Object.keys(this.config.namesystemConfig.register.subdomains || {}).map((subDomainName) => {
return new Promise(async (resolve, _reject) => {
const address = this.config.namesystemConfig.register.subdomains[subDomainName];
const directivesRegExp = new RegExp(/\$(\w+\[?\d?\]?)/g);