mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 03:30:35 +00:00
common/compiler: json unmarshalling error checks (#25449)
complier/solidity:add json.Unmarshal err check
This commit is contained in:
parent
fea569f90a
commit
49aa8a633b
@ -66,13 +66,16 @@ func ParseCombinedJSON(combinedJSON []byte, source string, languageVersion strin
|
|||||||
contracts := make(map[string]*Contract)
|
contracts := make(map[string]*Contract)
|
||||||
for name, info := range output.Contracts {
|
for name, info := range output.Contracts {
|
||||||
// Parse the individual compilation results.
|
// Parse the individual compilation results.
|
||||||
var abi interface{}
|
var abi, userdoc, devdoc interface{}
|
||||||
if err := json.Unmarshal([]byte(info.Abi), &abi); err != nil {
|
if err := json.Unmarshal([]byte(info.Abi), &abi); err != nil {
|
||||||
return nil, fmt.Errorf("solc: error reading abi definition (%v)", err)
|
return nil, fmt.Errorf("solc: error reading abi definition (%v)", err)
|
||||||
}
|
}
|
||||||
var userdoc, devdoc interface{}
|
if err := json.Unmarshal([]byte(info.Userdoc), &userdoc); err != nil {
|
||||||
json.Unmarshal([]byte(info.Userdoc), &userdoc)
|
return nil, fmt.Errorf("solc: error reading userdoc definition (%v)", err)
|
||||||
json.Unmarshal([]byte(info.Devdoc), &devdoc)
|
}
|
||||||
|
if err := json.Unmarshal([]byte(info.Devdoc), &devdoc); err != nil {
|
||||||
|
return nil, fmt.Errorf("solc: error reading devdoc definition (%v)", err)
|
||||||
|
}
|
||||||
|
|
||||||
contracts[name] = &Contract{
|
contracts[name] = &Contract{
|
||||||
Code: "0x" + info.Bin,
|
Code: "0x" + info.Bin,
|
||||||
|
Loading…
Reference in New Issue
Block a user