From 1c24bf24919ca81bffb5ae30696e4658c6f5295f Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 21 Jul 2025 10:19:32 +1000 Subject: [PATCH] engine: Fix nil pointer panic in TestGetHistoricCandles (#1976) * Initial plan * Fix nil pointer panic in TestGetHistoricCandles by adding early returns Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com> * Replace error handling with require.NoError in TestGetHistoricCandles Co-authored-by: gbjk <86617+gbjk@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: thrasher- <4685270+thrasher-@users.noreply.github.com> Co-authored-by: gbjk <86617+gbjk@users.noreply.github.com> --- engine/rpcserver_test.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/engine/rpcserver_test.go b/engine/rpcserver_test.go index 1b8fcb39..f3332b5f 100644 --- a/engine/rpcserver_test.go +++ b/engine/rpcserver_test.go @@ -821,9 +821,7 @@ func TestGetHistoricCandles(t *testing.T) { AssetType: asset.Spot.String(), TimeInterval: int64(kline.OneHour.Duration()), }) - if err != nil { - t.Error(err) - } + require.NoError(t, err) if len(results.Candle) == 0 { t.Error("expected results") } @@ -842,9 +840,7 @@ func TestGetHistoricCandles(t *testing.T) { Sync: true, ExRequest: true, }) - if err != nil { - t.Error(err) - } + require.NoError(t, err) if len(results.Candle) == 0 { t.Error("expected results") } @@ -862,9 +858,7 @@ func TestGetHistoricCandles(t *testing.T) { TimeInterval: int64(kline.OneHour.Duration()), UseDb: true, }) - if err != nil { - t.Error(err) - } + require.NoError(t, err) if len(results.Candle) == 0 { t.Error("expected results") } @@ -896,9 +890,7 @@ func TestGetHistoricCandles(t *testing.T) { UseDb: true, FillMissingWithTrades: true, }) - if err != nil { - t.Error(err) - } + require.NoError(t, err) if results.Candle[len(results.Candle)-1].Close != 1337 { t.Error("expected fancy new candle based off fancy new trade data") }