Qt/Bugfix: fix handling default wallet with no name

This commit is contained in:
João Barbosa 2018-05-18 15:34:47 +01:00 committed by Jonas Schnelli
parent d792e47421
commit 13c3a659c0
No known key found for this signature in database
GPG Key ID: 1EB776BB03C7922D

View File

@ -312,7 +312,7 @@ bool RPCConsole::RPCParseCommandLine(interfaces::Node* node, std::string &strRes
std::string method = stack.back()[0]; std::string method = stack.back()[0];
std::string uri; std::string uri;
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
if (walletID && !walletID->empty()) { if (walletID) {
QByteArray encodedName = QUrl::toPercentEncoding(QString::fromStdString(*walletID)); QByteArray encodedName = QUrl::toPercentEncoding(QString::fromStdString(*walletID));
uri = "/wallet/"+std::string(encodedName.constData(), encodedName.length()); uri = "/wallet/"+std::string(encodedName.constData(), encodedName.length());
} }
@ -425,7 +425,7 @@ void RPCExecutor::request(const QString &command, const QString &walletID)
return; return;
} }
std::string wallet_id = walletID.toStdString(); std::string wallet_id = walletID.toStdString();
if(!RPCConsole::RPCExecuteCommandLine(m_node, result, executableCommand, nullptr, &wallet_id)) if (!RPCConsole::RPCExecuteCommandLine(m_node, result, executableCommand, nullptr, walletID.isNull() ? nullptr : &wallet_id))
{ {
Q_EMIT reply(RPCConsole::CMD_ERROR, QString("Parse error: unbalanced ' or \"")); Q_EMIT reply(RPCConsole::CMD_ERROR, QString("Parse error: unbalanced ' or \""));
return; return;
@ -909,7 +909,7 @@ void RPCConsole::on_lineEdit_returnPressed()
} }
if (m_last_wallet_id != walletID) { if (m_last_wallet_id != walletID) {
if (walletID.isEmpty()) { if (walletID.isNull()) {
message(CMD_REQUEST, tr("Executing command without any wallet")); message(CMD_REQUEST, tr("Executing command without any wallet"));
} else { } else {
message(CMD_REQUEST, tr("Executing command using \"%1\" wallet").arg(walletID)); message(CMD_REQUEST, tr("Executing command using \"%1\" wallet").arg(walletID));