diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2011-11-10 10:30:24 -0500 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2011-11-10 10:30:24 -0500 |
commit | ba1fce94b5c11a8b91919c3d9d873bcf74e5f93a (patch) | |
tree | ce2cc3e430fb3b18de820966e953723e13327241 /src/qt/sendcoinsdialog.cpp | |
parent | 5efee7da866fd6ec9cbf059f253d6d98964bd817 (diff) | |
parent | dead0ff8cd90eb39f1d9278539d2b3579982b3de (diff) |
Merge branch 'nullmodels' of https://github.com/laanwj/bitcoin
Diffstat (limited to 'src/qt/sendcoinsdialog.cpp')
-rw-r--r-- | src/qt/sendcoinsdialog.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 719cc51880..762f27dfa6 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -43,9 +43,11 @@ void SendCoinsDialog::setModel(WalletModel *model) entry->setModel(model); } } - - setBalance(model->getBalance(), model->getUnconfirmedBalance()); - connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64))); + if(model) + { + setBalance(model->getBalance(), model->getUnconfirmedBalance()); + connect(model, SIGNAL(balanceChanged(qint64, qint64)), this, SLOT(setBalance(qint64, qint64))); + } } SendCoinsDialog::~SendCoinsDialog() @@ -57,6 +59,10 @@ void SendCoinsDialog::on_sendButton_clicked() { QList<SendCoinsRecipient> recipients; bool valid = true; + + if(!model) + return; + for(int i = 0; i < ui->entries->count(); ++i) { SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget()); @@ -255,6 +261,9 @@ void SendCoinsDialog::handleURL(const QUrl *url) void SendCoinsDialog::setBalance(qint64 balance, qint64 unconfirmedBalance) { Q_UNUSED(unconfirmedBalance); + if(!model || !model->getOptionsModel()) + return; + int unit = model->getOptionsModel()->getDisplayUnit(); ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balance)); } |