From 919007ef160f3af48ff97399f5d59ec3bba2840a Mon Sep 17 00:00:00 2001 From: peter <1674920+peterbitfly@users.noreply.github.com> Date: Thu, 9 Mar 2023 10:03:35 +0100 Subject: [PATCH] (NOBIDS) fix internal server error on withdrawals page, remove error in GetDataTableState --- db/db.go | 2 +- handlers/common.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/db/db.go b/db/db.go index 091ccf0447..db895b1802 100644 --- a/db/db.go +++ b/db/db.go @@ -2159,7 +2159,7 @@ func GetSlotWithdrawals(slot uint64) ([]*types.Withdrawals, error) { func GetTotalWithdrawals() (total uint64, err error) { err = ReaderDb.Get(&total, ` SELECT - MAX(withdrawalindex) + COALESCE(MAX(withdrawalindex), 0) FROM blocks_withdrawals`) if err == sql.ErrNoRows { diff --git a/handlers/common.go b/handlers/common.go index 4d75fbaafc..5e4eb8e34a 100644 --- a/handlers/common.go +++ b/handlers/common.go @@ -1,6 +1,7 @@ package handlers import ( + "database/sql" "encoding/hex" "encoding/json" "errors" @@ -328,7 +329,7 @@ func GetDataTableState(user *types.User, session *utils.CustomSession, tableKey } if user.Authenticated { state, err := db.GetDataTablesState(user.UserID, tableKey) - if err != nil { + if err != nil && err != sql.ErrNoRows { logger.Errorf("error getting data table state from db: %v", err) return state }