qt, rpc, refactor: Return early in RPCConsole::on_lineEdit_returnPressed

This commit is contained in:
Hennadii Stepanov committed 2021-05-31 23:32:59 +03:00
1 parent 5b9c8c9cdd
commit ccf790287c
1 file changed
+7 -7
+7 -7
View File
@@ -926,8 +926,10 @@ void RPCConsole::on_lineEdit_returnPressed()
{ {
QString cmd = ui->lineEdit->text(); QString cmd = ui->lineEdit->text();
if(!cmd.isEmpty()) if (cmd.isEmpty()) {
{ return;
}
std::string strFilteredCmd; std::string strFilteredCmd;
try { try {
std::string dummy; std::string dummy;
@@ -942,8 +944,6 @@ void RPCConsole::on_lineEdit_returnPressed()
ui->lineEdit->clear(); ui->lineEdit->clear();
cmdBeforeBrowsing = QString();
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
WalletModel* wallet_model = ui->WalletSelector->currentData().value<WalletModel*>(); WalletModel* wallet_model = ui->WalletSelector->currentData().value<WalletModel*>();
@@ -955,7 +955,7 @@ void RPCConsole::on_lineEdit_returnPressed()
} }
m_last_wallet_model = wallet_model; m_last_wallet_model = wallet_model;
} }
#endif #endif // ENABLE_WALLET
message(CMD_REQUEST, QString::fromStdString(strFilteredCmd)); message(CMD_REQUEST, QString::fromStdString(strFilteredCmd));
//: A console message indicating an entered command is currently being executed. //: A console message indicating an entered command is currently being executed.
@@ -969,14 +969,14 @@ void RPCConsole::on_lineEdit_returnPressed()
// Append command to history // Append command to history
history.append(cmd); history.append(cmd);
// Enforce maximum history size // Enforce maximum history size
while(history.size() > CONSOLE_HISTORY) while (history.size() > CONSOLE_HISTORY) {
history.removeFirst(); history.removeFirst();
}
// Set pointer to end of history // Set pointer to end of history
historyPtr = history.size(); historyPtr = history.size();
// Scroll console view to end // Scroll console view to end
scrollToEnd(); scrollToEnd();
}
} }
void RPCConsole::browseHistory(int offset) void RPCConsole::browseHistory(int offset)