From d12dc0362d72af04a26ec55db21a58476ce72cfe Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Tue, 24 Jun 2025 14:55:42 +0200 Subject: [PATCH] loopd: avoid panic if asset client is not set --- loopd/swapclient_server.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index a0fe44e10..313db6fc3 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -418,11 +418,20 @@ func (s *swapClientServer) marshallSwap(ctx context.Context, outGoingChanSet = loopSwap.OutgoingChanSet if loopSwap.AssetSwapInfo != nil { - assetName, err := s.assetClient.GetAssetName( - ctx, loopSwap.AssetSwapInfo.AssetId, + var ( + // Default the asset name to "N/A" in case we + // can't fetch it due to the asset client not + // being set. + assetName string = "N/A" + err error ) - if err != nil { - return nil, err + if s.assetClient != nil { + assetName, err = s.assetClient.GetAssetName( + ctx, loopSwap.AssetSwapInfo.AssetId, + ) + if err != nil { + return nil, err + } } assetInfo = &looprpc.AssetLoopOutInfo{