Skip to content

Commit

Permalink
Return an empty slice (rather than nil) for zero token accounts
Browse files Browse the repository at this point in the history
Fixes #345

Signed-off-by: Andrew Richardson <[email protected]>
  • Loading branch information
awrichar committed Dec 2, 2021
1 parent cc0b2a2 commit d3d1fbf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/database/sqlcommon/tokenbalance_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (s *SQLCommon) GetTokenAccounts(ctx context.Context, filter database.Filter
}
defer rows.Close()

var accounts []*fftypes.TokenAccount
accounts := make([]*fftypes.TokenAccount, 0)
for rows.Next() {
var account fftypes.TokenAccount
if err := rows.Scan(&account.Key); err != nil {
Expand Down Expand Up @@ -239,7 +239,7 @@ func (s *SQLCommon) GetTokenAccountPools(ctx context.Context, key string, filter
}
defer rows.Close()

var pools []*fftypes.TokenAccountPool
pools := make([]*fftypes.TokenAccountPool, 0)
for rows.Next() {
var pool fftypes.TokenAccountPool
if err := rows.Scan(&pool.Pool); err != nil {
Expand Down

0 comments on commit d3d1fbf

Please sign in to comment.