diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index c154d9c66e..b76602c50a 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -286,27 +286,31 @@ function compileTab (container, appAPI, appEvents, opts) { function details () { var select = el.querySelector('select') - var contractName = select.children[select.selectedIndex].innerText - var details = contractsDetails[contractName] - var keys = Object.keys(contractsDetails[contractName]) - var log = yo`
` - keys.map(x => { - var copyDetails = yo` { copy(details[x]) }} aria-hidden="true">` - log.appendChild(yo`
${x}: ${JSON.stringify(details[x], null, 4)}
${copyDetails}
`) - }) - modalDialog(contractName, log, {label: 'OK'}, {label: ''}) + if (select.children.length > 0 && select.selectedIndex >= 0) { + var contractName = select.children[select.selectedIndex].innerText + var details = contractsDetails[contractName] + var keys = Object.keys(contractsDetails[contractName]) + var log = yo`
` + keys.map(x => { + var copyDetails = yo` { copy(details[x]) }} aria-hidden="true">` + log.appendChild(yo`
${x}: ${JSON.stringify(details[x], null, 4)}
${copyDetails}
`) + }) + modalDialog(contractName, log, {label: 'OK'}, {label: ''}) + } } function publish (appAPI) { var selectContractNames = document.querySelector(`.${css.contractNames.classNames[0]}`) - var contract = contractsDetails[selectContractNames.children[selectContractNames.selectedIndex].innerText] - publishOnSwarm(contract, appAPI, function (err) { - if (err) { - alert('Failed to publish metadata: ' + err) - } else { - alert('Metadata published successfully') - } - }) + if (selectContractNames.children.length > 0 && selectContractNames.selectedIndex >= 0) { + var contract = contractsDetails[selectContractNames.children[selectContractNames.selectedIndex].innerText] + publishOnSwarm(contract, appAPI, function (err) { + if (err) { + alert('Failed to publish metadata: ' + err) + } else { + alert('Metadata published successfully') + } + }) + } } return el } diff --git a/src/app/tabs/run-tab.js b/src/app/tabs/run-tab.js index 00256f3a05..25fba76172 100644 --- a/src/app/tabs/run-tab.js +++ b/src/app/tabs/run-tab.js @@ -231,7 +231,7 @@ function contractDropdown (appAPI, appEvents, instanceContainer) { function setInputParamsPlaceHolder () { createButtonInput.value = '' - if (appAPI.getContracts()) { + if (appAPI.getContracts() && selectContractNames.selectedIndex >= 0 && selectContractNames.children.length > 0) { var contract = appAPI.getContracts()[selectContractNames.children[selectContractNames.selectedIndex].innerText] var ctrabi = txHelper.getConstructorInterface(contract.interface) if (ctrabi.inputs.length) {