Skip to content

Commit

Permalink
Merge pull request #172 from AvianNetwork/4.1-walletmodel-segfault
Browse files Browse the repository at this point in the history
qt: Check wallet model to prevent segfault
  • Loading branch information
alamshafil authored Sep 15, 2022
2 parents e4e0e2c + e6165e3 commit 75b9380
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,16 +409,26 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
// Network request code for price
QObject::connect(networkManager, &QNetworkAccessManager::finished,
this, [=](QNetworkReply* reply) {

// Default values
int unit = 0;
QString currency = "usd";

if (reply->error()) {
qDebug() << reply->errorString();
// Failed to get price info, just display total balance.
ui->labelTotal->setText(AvianUnits::formatWithUnit(unit, currentBalance + currentUnconfirmedBalance + currentImmatureBalance, false, AvianUnits::separatorAlways));
return;
}

if (walletModel->getOptionsModel()) {
// Get selected unit
unit = walletModel->getOptionsModel()->getDisplayUnit();

// Get selected unit
int unit = walletModel->getOptionsModel()->getDisplayUnit();
// Get user currency unit
currency = walletModel->getOptionsModel()->getDisplayCurrency();
}

// Get user currency unit
QString currency = walletModel->getOptionsModel()->getDisplayCurrency();

// Get the data from the network request
QString answer = reply->readAll();
Expand Down

0 comments on commit 75b9380

Please sign in to comment.