From 1dcd30b3a8415518b6700a860f41205b4cf49f4b Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 12 Jun 2018 13:24:21 -0400 Subject: [PATCH] don't crash and instead inform user if contract cannot be profiled --- lib/modules/profiler/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/modules/profiler/index.js b/lib/modules/profiler/index.js index 34557e473..139464c28 100644 --- a/lib/modules/profiler/index.js +++ b/lib/modules/profiler/index.js @@ -53,10 +53,14 @@ class Profiler { let cmdName = cmd.split(' ')[0]; let contractName = cmd.split(' ')[1]; if (cmdName === 'profile') { - self.events.request('contracts:contract', contractName, (contract) => { - self.logger.info("-- profile for " + contractName); - this.profile(contractName, contract); - }); + self.events.request('contracts:contract', contractName, (contract) => { + if (!contract.deployedAddress) { + self.logger.info("-- couldn't profile " + contractName + " - it's not deployed or could be an interface"); + return ""; + } + self.logger.info("-- profile for " + contractName); + this.profile(contractName, contract); + }); return ""; } return false;