Skip to content

Commit 1f20f42

Browse files
Merge pull request #39 from KristiforMilchev/development
Removing lose methods causing the app to crash due to null reference …
2 parents 7197929 + 8e9e958 commit 1f20f42

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

Data/ContractService.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ private static async Task<decimal> GetImportedData(NetworkSettings network, Toke
300300

301301
private static async Task<List<Token>> GetListedTokens(List<ListedToken> listedTokenData, List<Token> tokens, NetworkSettings network)
302302
{
303+
if (listedTokenData == null)
304+
return tokens;
305+
303306
foreach(var token in listedTokenData)
304307
{
305308
var currentToken = await Utilities.GetRequest<Token>($"https://raw.githubusercontent.com/KristiforMilchev/LInksync-Cold-Storage-Wallet/main/Models/Tokens/{token.name}/token.json");

MauiProgram.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public static async Task<MauiApp> CreateMauiApp()
5656
});
5757

5858
builder.Services.AddMauiBlazorWebView();
59+
builder.Services.AddLogging();
5960
#if DEBUG
6061
builder.Services.AddBlazorWebViewDeveloperTools();
6162
#endif

Pages/Landing.razor

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,12 @@
517517
{
518518
await InvokeAsync( async () =>
519519
{
520-
Tokens = await Authenication.GetSupportedTokens(SelectedNetwork.Id); //Get All tokens and their balance
521-
StateHasChanged();
520+
if(SelectedNetwork != null)
521+
{
522+
Tokens = await Authenication.GetSupportedTokens(SelectedNetwork.Id); //Get All tokens and their balance
523+
StateHasChanged();
524+
}
525+
522526
});
523527

524528

Services/Implementation/Utilities.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
using Newtonsoft.Json;
22
using SYNCWallet.Models;
3-
using System;
4-
using System.Collections.Generic;
53
using System.Diagnostics;
6-
using System.Linq;
7-
using System.Runtime.InteropServices;
84
using System.Text;
9-
using System.Threading.Tasks;
105

116
namespace SYNCWallet.Services.Implementation
127
{
@@ -24,8 +19,8 @@ public async Task<List<NetworkSettings>> SetupNetworks()
2419

2520
var filesContent = File.ReadAllText($"{GetOsSavePath()}/LocalNetworks.json");
2621
var convertedNetworkList = JsonConvert.DeserializeObject<List<NetworkSettings>>(filesContent);
27-
28-
whiteListedNetworks.AddRange(convertedNetworkList);
22+
if(convertedNetworkList != null)
23+
whiteListedNetworks.AddRange(convertedNetworkList);
2924
return whiteListedNetworks;
3025
}
3126

0 commit comments

Comments
 (0)