diff --git a/Solana.Unity.Anchor.Tool/AnchorSourceGenerator.cs b/Solana.Unity.Anchor.Tool/AnchorSourceGenerator.cs index 1ee1521..9870dde 100644 --- a/Solana.Unity.Anchor.Tool/AnchorSourceGenerator.cs +++ b/Solana.Unity.Anchor.Tool/AnchorSourceGenerator.cs @@ -46,7 +46,12 @@ static int Main(string[] args) var jsonParsed = JObject.Parse(idlStr); // Set UnixTimestamp to Int64 in accounts - foreach (JToken account in (JArray)jsonParsed["accounts"]) + if (!jsonParsed.TryGetValue("accounts", out JToken val)) + { + val = new JArray(); + } + + foreach (JToken account in (JArray)val) { JToken accountType = account["type"]; foreach (JObject fields in (JArray)accountType["fields"])