aboutsummaryrefslogtreecommitdiff
path: root/src/qt/overviewpage.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2011-11-10 10:30:24 -0500
committerGavin Andresen <gavinandresen@gmail.com>2011-11-10 10:30:24 -0500
commitba1fce94b5c11a8b91919c3d9d873bcf74e5f93a (patch)
treece2cc3e430fb3b18de820966e953723e13327241 /src/qt/overviewpage.cpp
parent5efee7da866fd6ec9cbf059f253d6d98964bd817 (diff)
parentdead0ff8cd90eb39f1d9278539d2b3579982b3de (diff)
Merge branch 'nullmodels' of https://github.com/laanwj/bitcoin
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);