aboutsummaryrefslogtreecommitdiff
path: root/src/qt/sendcoinsdialog.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/sendcoinsdialog.cpp
parent5efee7da866fd6ec9cbf059f253d6d98964bd817 (diff)
parentdead0ff8cd90eb39f1d9278539d2b3579982b3de (diff)
Merge branch 'nullmodels' of https://github.com/laanwj/bitcoin
Diffstat (limited to 'src/qt/sendcoinsdialog.cpp')
-rw-r--r--src/qt/sendcoinsdialog.cpp15
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));
}