Skip to content

Commit

Permalink
fix: npe issues
Browse files Browse the repository at this point in the history
  • Loading branch information
becket01 committed Jan 24, 2025
1 parent 0085e1a commit 19fcfc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/EoaServer.Application/Token/TokenAppService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ public async Task<List<GetTokenListDto>> GetTokenListAsync(GetTokenListRequestDt
{
var chainIndexerToken =
await _aelfScanDataProvider.GetTokenListAsync(chainId, input.Symbol);
if (chainIndexerToken != null)
if (chainIndexerToken != null && !chainIndexerToken.List.IsNullOrEmpty())
{
indexerTokens.AddRange(chainIndexerToken.List);
}
}

var userTokensDto = await _userTokenProvider.GetUserTokenInfoListAsync(
CurrentUser.GetId(),
CurrentUser.IsAuthenticated ? CurrentUser.GetId() : Guid.Empty,
input.ChainIds.Count == 1 ? input.ChainIds.First() : string.Empty,
string.Empty);

Expand Down
5 changes: 3 additions & 2 deletions src/EoaServer.Application/UserAssets/UserAssetsAppService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public async Task<GetTokenDto> GetTokenAsync(GetTokenRequestDto requestDto)
foreach (var addressInfo in requestDto.AddressInfos)
{
var chainTokenList = await _aelfScanDataProvider.GetAddressTokenAssetsAsync(addressInfo.ChainId, addressInfo.Address);
if (chainTokenList == null || chainTokenList.List.IsNullOrEmpty()) continue;
tokenList.AssetInUsd += chainTokenList.AssetInUsd;
tokenList.AssetInElf += chainTokenList.AssetInElf;
tokenList.Total += chainTokenList.Total;
Expand Down Expand Up @@ -113,7 +114,7 @@ public async Task<GetNftCollectionsDto> GetNFTCollectionsAsync(GetNftCollections
foreach (var addressInfo in requestDto.AddressInfos)
{
var chainTokenList = await _aelfScanDataProvider.GetAddressNftListAsync(addressInfo.ChainId, addressInfo.Address);
if (chainTokenList != null)
if (chainTokenList != null && !chainTokenList.List.IsNullOrEmpty())
{
nftList.Total += chainTokenList.Total;
nftList.List.AddRange(chainTokenList.List);
Expand Down Expand Up @@ -417,7 +418,7 @@ private async Task<List<AddressNftInfoDto>> GetUserCollectionItemsAsync(List<Add
{
// get all NFT for TotalNftItemCount
var chainTokenList = await _aelfScanDataProvider.GetAddressNftListAsync(addressInfo.ChainId, addressInfo.Address);
if (chainTokenList != null)
if (chainTokenList != null && !chainTokenList.List.IsNullOrEmpty())
{
nftList.AddRange(chainTokenList.List);
}
Expand Down

0 comments on commit 19fcfc1

Please sign in to comment.