Mercurial > hg > bitcoin
changeset 1259:4d7cd9c4083a draft
allow empty/missing amounts in URL
author | Wladimir J. van der Laan <laanwj@gmail.com> |
---|---|
date | Sun, 07 Aug 2011 16:16:49 +0200 |
parents | d0d7e33253e5 |
children | 108fc80b7833 |
files | src/qt/guiutil.cpp src/qt/guiutil.h |
diffstat | 2 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -53,9 +53,18 @@ SendCoinsRecipient rv; rv.address = url->path(); rv.label = url->queryItemValue("label"); - if(!BitcoinUnits::parse(BitcoinUnits::BTC, url->queryItemValue("amount"), &rv.amount)) + + QString amount = url->queryItemValue("amount"); + if(amount.isEmpty()) { - return false; + rv.amount = 0; + } + else // Amount is non-empty + { + if(!BitcoinUnits::parse(BitcoinUnits::BTC, amount, &rv.amount)) + { + return false; + } } if(out) {
--- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -27,6 +27,7 @@ static void setupAmountWidget(QLineEdit *widget, QWidget *parent); // Parse "bitcoin:" URL into recipient object, return true on succesful parsing + // See Bitcoin URL definition discussion here: https://bitcointalk.org/index.php?topic=33490.0 static bool parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out); };