From 9a722a58a0c74ab8993de025818950ec5342d368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Thu, 17 Mar 2022 16:01:39 +0900 Subject: [PATCH] Check for malformed responses in getAccountInfo/getMultipleAccounts GetObject could unmarshal into nil which would cause a panic when referring to out.Value. --- rpc/getAccountInfo.go | 2 +- rpc/getMultipleAccounts.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rpc/getAccountInfo.go b/rpc/getAccountInfo.go index d9be3b09..2e6dbedc 100644 --- a/rpc/getAccountInfo.go +++ b/rpc/getAccountInfo.go @@ -124,7 +124,7 @@ func (cl *Client) GetAccountInfoWithOpts( if err != nil { return nil, err } - if out.Value == nil { + if out == nil || out.Value == nil { return nil, ErrNotFound } diff --git a/rpc/getMultipleAccounts.go b/rpc/getMultipleAccounts.go index af316cf9..cd88d145 100644 --- a/rpc/getMultipleAccounts.go +++ b/rpc/getMultipleAccounts.go @@ -74,7 +74,7 @@ func (cl *Client) GetMultipleAccountsWithOpts( if err != nil { return nil, err } - if out.Value == nil { + if out == nil || out.Value == nil { return nil, ErrNotFound } return