From 9f8f07e13bef5fc2ca06612d3cc742bcf862548c Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sun, 9 Jun 2019 20:41:48 +0200 Subject: [PATCH] Fix for NullRef --- Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs | 37 +++++++++++++----------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs index 1e46a4ce..2e2a9443 100644 --- a/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs +++ b/Site/Pages/v5/Ledgers/EndOfMonth.aspx.cs @@ -115,25 +115,28 @@ namespace Swarmops.Frontend.Pages.Ledgers // Check if we need to add a resync of the hotwallet's native ledger - Int64 cashSatoshisInLedger = - CurrentOrganization.FinancialAccounts.AssetsBitcoinHot.GetForeignCurrencyBalanceDeltaCents( - Constants.DateTimeLow, Constants.DateTimeHigh).Cents; - - Int64 cashSatoshisInHotwallet = - HotBitcoinAddresses.GetSatoshisInHotwallet(CurrentOrganization)[BitcoinChain.Cash]; - - if (cashSatoshisInHotwallet != cashSatoshisInLedger) + if (CurrentOrganization.FinancialAccounts.AssetsBitcoinHot != null) // has hotwallet { - // Resync required + Int64 cashSatoshisInLedger = + CurrentOrganization.FinancialAccounts.AssetsBitcoinHot.GetForeignCurrencyBalanceDeltaCents( + Constants.DateTimeLow, Constants.DateTimeHigh).Cents; - EomItem resyncSatoshiCountItem = new EomItem(); - resyncSatoshiCountItem.Id = "ResyncSatoshisInLedger"; - resyncSatoshiCountItem.Icon = "approve"; - resyncSatoshiCountItem.Completed = false; - resyncSatoshiCountItem.Skippable = false; - resyncSatoshiCountItem.Callback = "ResyncSatoshisInLedger"; - resyncSatoshiCountItem.Name = Resources.Pages.Ledgers.EndOfMonth_CheckLedgerAgainstHotWallet; - group1.Items.Add(resyncSatoshiCountItem); + Int64 cashSatoshisInHotwallet = + HotBitcoinAddresses.GetSatoshisInHotwallet(CurrentOrganization)[BitcoinChain.Cash]; + + if (cashSatoshisInHotwallet != cashSatoshisInLedger) + { + // Resync required + + EomItem resyncSatoshiCountItem = new EomItem(); + resyncSatoshiCountItem.Id = "ResyncSatoshisInLedger"; + resyncSatoshiCountItem.Icon = "approve"; + resyncSatoshiCountItem.Completed = false; + resyncSatoshiCountItem.Skippable = false; + resyncSatoshiCountItem.Callback = "ResyncSatoshisInLedger"; + resyncSatoshiCountItem.Name = Resources.Pages.Ledgers.EndOfMonth_CheckLedgerAgainstHotWallet; + group1.Items.Add(resyncSatoshiCountItem); + } } } }