Set label when selecting an address that already has a label. Fixes #1080.
authorWladimir J. van der Laan <laanwj@gmail.com>
Fri, 13 Apr 2012 19:08:46 +0000 (21:08 +0200)
committerWladimir J. van der Laan <laanwj@gmail.com>
Fri, 13 Apr 2012 19:08:46 +0000 (21:08 +0200)
src/qt/sendcoinsentry.cpp

index caffaae..c8242d8 100644 (file)
@@ -59,9 +59,11 @@ void SendCoinsEntry::on_payTo_textChanged(const QString &address)
 {
     if(!model)
         return;
-    // Fill in label from address book, if no label is filled in yet
-    if(ui->addAsLabel->text().isEmpty())
-        ui->addAsLabel->setText(model->getAddressTableModel()->labelForAddress(address));}
+    // Fill in label from address book, if address has an associated label
+    QString associatedLabel = model->getAddressTableModel()->labelForAddress(address);
+    if(!associatedLabel.isEmpty())
+        ui->addAsLabel->setText(associatedLabel);
+}
 
 void SendCoinsEntry::setModel(WalletModel *model)
 {