mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loopd: avoid panic if asset client is not set
This commit is contained in:
parent
e145963f2e
commit
d12dc0362d
1 changed files with 13 additions and 4 deletions
|
|
@ -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{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue