From 3ccd0a567fbfbcc1310f031f7d60f78c5d8139b6 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 26 Jun 2023 23:02:21 +0300 Subject: [PATCH] fix: wrap in try/catch, show an error message when an exception is caught --- src/qt/transactiontablemodel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 5668838238d36..9dc74a7ed7e5f 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -23,6 +23,7 @@ #include #include #include +#include // Amount column is right-aligned it contains numbers @@ -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(); }