From 59525e54b3d0826b7330f992862bf8c8cd12890a Mon Sep 17 00:00:00 2001 From: adityapk00 Date: Sat, 10 Nov 2018 09:10:22 -0800 Subject: [PATCH] #34 - Fix memo address validation --- src/mainwindow.h | 2 +- src/sendtab.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.h b/src/mainwindow.h index c789081..409df82 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -92,7 +92,7 @@ private: void restoreSavedStates(); - QString addressFromAddressField(const QString& lblAddr) { return lblAddr.split("/").last(); } + QString addressFromAddressField(const QString& lblAddr) { return lblAddr.trimmed().split("/").last(); } RPC* rpc = nullptr; QCompleter* labelCompleter = nullptr; diff --git a/src/sendtab.cpp b/src/sendtab.cpp index c804f05..01475bb 100644 --- a/src/sendtab.cpp +++ b/src/sendtab.cpp @@ -267,7 +267,7 @@ void MainWindow::setMemoEnabled(int number, bool enabled) { void MainWindow::memoButtonClicked(int number) { // Memos can only be used with zAddrs. So check that first auto addr = ui->sendToWidgets->findChild(QString("Address") + QString::number(number)); - if (!addr->text().trimmed().startsWith("z")) { + if (!addressFromAddressField(addr->text()).startsWith("z")) { QMessageBox msg(QMessageBox::Critical, "Memos can only be used with z-addresses", "The memo field can only be used with a z-address.\n" + addr->text() + "\ndoesn't look like a z-address", QMessageBox::Ok, this);