Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
catch data format exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangTao1596 committed Nov 17, 2021
1 parent 1d53db3 commit 2a97a53
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions neo-cli/CLI/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,15 @@ private byte[] LoadDeploymentScript(string nefFilePath, string manifestFilePath,

ContractParameter dataParameter = null;
if (data is not null)
dataParameter = ContractParameter.FromJson(data);
try
{
dataParameter = ContractParameter.FromJson(data);
}
catch
{
throw new FormatException("invalid data");
}


// Basic script checks

Expand Down Expand Up @@ -322,7 +330,14 @@ private byte[] LoadUpdateScript(UInt160 scriptHash, string nefFilePath, string m

ContractParameter dataParameter = null;
if (data is not null)
dataParameter = ContractParameter.FromJson(data);
try
{
dataParameter = ContractParameter.FromJson(data);
}
catch
{
throw new FormatException("invalid data");
}

// Basic script checks

Expand Down

0 comments on commit 2a97a53

Please sign in to comment.