Skip to content

Commit

Permalink
fix: wrap in try/catch, show an error message when an exception is ca…
Browse files Browse the repository at this point in the history
…ught
  • Loading branch information
UdjinM6 committed Jun 26, 2023
1 parent d013cb4 commit 3ccd0a5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/qt/transactiontablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <QDebug>
#include <QIcon>
#include <QList>
#include <QMessageBox>


// Amount column is right-aligned it contains numbers
Expand Down Expand Up @@ -75,13 +76,15 @@ class TransactionTablePriv
{
qDebug() << "TransactionTablePriv::refreshWallet";
parent->beginResetModel();
cachedWallet.clear();
{
try {
cachedWallet.clear();
for (const auto& wtx : wallet.getWalletTxs()) {
if (TransactionRecord::showTransaction()) {
cachedWallet.append(TransactionRecord::decomposeTransaction(wallet, wtx));
}
}
} catch(const std::exception& e) {
QMessageBox::critical(nullptr, PACKAGE_NAME, QString("Failed to refresh wallet table: ") + QString::fromStdString(e.what()));
}
parent->endResetModel();
}
Expand Down

0 comments on commit 3ccd0a5

Please sign in to comment.