aboutsummaryrefslogtreecommitdiff
path: root/src/qt/overviewpage.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-11-08 21:18:36 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2011-11-08 21:18:36 +0100
commitdead0ff8cd90eb39f1d9278539d2b3579982b3de (patch)
tree566823e2886404bf81b3ee94d99ba03497119590 /src/qt/overviewpage.cpp
parent0fb0a38339e5cb404147c89f73ff10d962a47ca5 (diff)
Add robustness against null models
Diffstat (limited to 'src/qt/overviewpage.cpp')
-rw-r--r--src/qt/overviewpage.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp
index 6dedde0272..fe0987178c 100644
--- a/src/qt/overviewpage.cpp
+++ b/src/qt/overviewpage.cpp
@@ -143,30 +143,34 @@ void OverviewPage::setNumTransactions(int count)
void OverviewPage::setModel(WalletModel *model)
{
this->model = model;
+ if(model)
+ {
+ // Set up transaction list
+ TransactionFilterProxy *filter = new TransactionFilterProxy();
+ filter->setSourceModel(model->getTransactionTableModel());
+ filter->setLimit(NUM_ITEMS);
+ filter->setDynamicSortFilter(true);
+ filter->setSortRole(Qt::EditRole);
+ filter->sort(TransactionTableModel::Status, Qt::DescendingOrder);
- // Set up transaction list
- TransactionFilterProxy *filter = new TransactionFilterProxy();
- filter->setSourceModel(model->getTransactionTableModel());
- filter->setLimit(NUM_ITEMS);
- filter->setDynamicSortFilter(true);
- filter->setSortRole(Qt::EditRole);
- filter->sort(TransactionTableModel::Status, Qt::DescendingOrder);
-
- ui->listTransactions->setModel(filter);
- ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress);
+ ui->listTransactions->setModel(filter);
+ ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress);
- // Keep up to date with wallet
- setBalance(model->getBalance(), model->getUnconfirmedBalance());
- connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64)));
+ // Keep up to date with wallet
+ setBalance(model->getBalance(), model->getUnconfirmedBalance());
+ connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64)));
- setNumTransactions(model->getNumTransactions());
- connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int)));
+ setNumTransactions(model->getNumTransactions());
+ connect(model, SIGNAL(numTransactionsChanged(int)), this, SLOT(setNumTransactions(int)));
- connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(displayUnitChanged()));
+ connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(displayUnitChanged()));
+ }
}
void OverviewPage::displayUnitChanged()
{
+ if(!model || !model->getOptionsModel())
+ return;
if(currentBalance != -1)
setBalance(currentBalance, currentUnconfirmedBalance);