From 3d5c35cd77ab4c1b12ae77d1a3748f4f0df90f65 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 20 Jul 2020 19:21:34 +0300 Subject: [PATCH] Fix qt tests --- src/qt/overviewpage.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 33e40c4cfa..53e25962bc 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -492,7 +492,12 @@ void OverviewPage::privateSendStatus(bool fForce) static int64_t nLastDSProgressBlockTime = 0; int nBestHeight = clientModel->getNumBlocks(); - CPrivateSendClientManager* privateSendClientManager = privateSendClientManagers.find(walletModel->getWallet()->GetName())->second; + auto it = privateSendClientManagers.find(walletModel->getWallet()->GetName()); + if (it == privateSendClientManagers.end()) { + // nothing to do + return; + } + CPrivateSendClientManager* privateSendClientManager = it->second; // We are processing more than 1 block per second, we'll just leave if(nBestHeight > privateSendClientManager->nCachedNumBlocks && GetTime() - nLastDSProgressBlockTime <= 1) return; @@ -605,7 +610,12 @@ void OverviewPage::togglePrivateSend(){ settings.setValue("hasMixed", "hasMixed"); } - CPrivateSendClientManager* privateSendClientManager = privateSendClientManagers.find(walletModel->getWallet()->GetName())->second; + auto it = privateSendClientManagers.find(walletModel->getWallet()->GetName()); + if (it == privateSendClientManagers.end()) { + // nothing to do + return; + } + CPrivateSendClientManager* privateSendClientManager = it->second; if (!privateSendClientManager->IsMixing()) { const CAmount nMinAmount = CPrivateSend::GetSmallestDenomination() + CPrivateSend::GetMaxCollateralAmount(); @@ -671,5 +681,10 @@ void OverviewPage::DisablePrivateSendCompletely() { if (nWalletBackups <= 0) { ui->labelPrivateSendEnabled->setText("(" + tr("Disabled") + ")"); } - privateSendClientManagers.at(walletModel->getWallet()->GetName())->StopMixing(); + auto it = privateSendClientManagers.find(walletModel->getWallet()->GetName()); + if (it == privateSendClientManagers.end()) { + // nothing to do + return; + } + it->second->StopMixing(); }