Fix profile command

In case the contract don't exist or the profile
command don't have argument, embark don't crash
and return an error
This commit is contained in:
Anthony Laibe 2018-07-25 09:51:10 +01:00 committed by Iuri Matias
parent a04f26dc3d
commit 7a34b9d675
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ class Profiler {
let contractName = cmd.split(' ')[1]; let contractName = cmd.split(' ')[1];
if (cmdName === 'profile') { if (cmdName === 'profile') {
self.events.request('contracts:contract', contractName, (contract) => { self.events.request('contracts:contract', contractName, (contract) => {
if (!contract.deployedAddress) { if (!contract || !contract.deployedAddress) {
self.logger.info("-- couldn't profile " + contractName + " - it's not deployed or could be an interface"); self.logger.info("-- couldn't profile " + contractName + " - it's not deployed or could be an interface");
return ""; return "";
} }