check metadata exist before saving it to the filesystem

checkMetadataExists
yann300 4 years ago
parent 832387514c
commit efb53d6a85
  1. 8
      apps/remix-ide/src/app/files/compiler-metadata.js

@ -56,7 +56,13 @@ class CompilerMetadata extends Plugin {
deploy[network] = self._syncContext(contract, deploy[network] || {})
})
provider.set(metadataFileName, JSON.stringify(JSON.parse(contract.object.metadata), null, '\t'))
let parsedMetadata
try {
parsedMetadata = JSON.parse(contract.object.metadata)
} catch (e) {
console.log(e)
}
if (parsedMetadata) provider.set(metadataFileName, JSON.stringify(parsedMetadata, null, '\t'))
var data = {
deploy,

Loading…
Cancel
Save