Skip to content

Commit

Permalink
Check script null
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon committed Apr 18, 2024
1 parent 13905e1 commit 71fbcd8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Neo/SmartContract/ContractParametersContext.cs
Expand Up @@ -44,7 +44,7 @@ public ContextItem(Contract contract)

public ContextItem(JObject json)
{
this.Script = Convert.FromBase64String(json["script"].AsString());
this.Script = json["script"] is JToken.Null ? null : Convert.FromBase64String(json["script"].AsString());
this.Parameters = ((JArray)json["parameters"]).Select(p => ContractParameter.FromJson((JObject)p)).ToArray();
this.Signatures = ((JObject)json["signatures"]).Properties.Select(p => new
{
Expand All @@ -56,7 +56,7 @@ public ContextItem(JObject json)
public JObject ToJson()
{
JObject json = new();
json["script"] = Convert.ToBase64String(Script);
json["script"] = Script == null ? null : Convert.ToBase64String(Script);
json["parameters"] = new JArray(Parameters.Select(p => p.ToJson()));
json["signatures"] = new JObject();
foreach (var signature in Signatures)
Expand Down

0 comments on commit 71fbcd8

Please sign in to comment.