Browse Source

Merge pull request #2926 from Diapolo/model_checks

Bitcoin-Qt: extend some checks for valid model pointers
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
e9e2ef5fbd
  1. 15
      src/qt/sendcoinsdialog.cpp
  2. 3
      src/qt/signverifymessagedialog.cpp

15
src/qt/sendcoinsdialog.cpp

@ -39,16 +39,17 @@ void SendCoinsDialog::setModel(WalletModel *model)
{ {
this->model = model; this->model = model;
for(int i = 0; i < ui->entries->count(); ++i) if(model && model->getOptionsModel())
{ {
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget()); for(int i = 0; i < ui->entries->count(); ++i)
if(entry)
{ {
entry->setModel(model); SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
entry->setModel(model);
}
} }
}
if(model && model->getOptionsModel())
{
setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance()); setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance());
connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64))); connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64)));
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));

3
src/qt/signverifymessagedialog.cpp

@ -102,6 +102,9 @@ void SignVerifyMessageDialog::on_pasteButton_SM_clicked()
void SignVerifyMessageDialog::on_signMessageButton_SM_clicked() void SignVerifyMessageDialog::on_signMessageButton_SM_clicked()
{ {
if (!model)
return;
/* Clear old signature to ensure users don't get confused on error with an old signature displayed */ /* Clear old signature to ensure users don't get confused on error with an old signature displayed */
ui->signatureOut_SM->clear(); ui->signatureOut_SM->clear();

Loading…
Cancel
Save