mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-11 15:48:05 +00:00
RPC console: don't crash on invalid input exception
This commit is contained in:
parent
c6aa86afc2
commit
ae744c8b78
@ -55,19 +55,26 @@ void RPCExecutor::start()
|
|||||||
void RPCExecutor::request(const QString &command)
|
void RPCExecutor::request(const QString &command)
|
||||||
{
|
{
|
||||||
// Parse shell-like command line into separate arguments
|
// Parse shell-like command line into separate arguments
|
||||||
boost::escaped_list_separator<char> els('\\',' ','\"');
|
|
||||||
std::string strCommand = command.toStdString();
|
|
||||||
boost::tokenizer<boost::escaped_list_separator<char> > tok(strCommand, els);
|
|
||||||
|
|
||||||
std::string strMethod;
|
std::string strMethod;
|
||||||
std::vector<std::string> strParams;
|
std::vector<std::string> strParams;
|
||||||
int n = 0;
|
try {
|
||||||
for(boost::tokenizer<boost::escaped_list_separator<char> >::iterator beg=tok.begin(); beg!=tok.end();++beg,++n)
|
boost::escaped_list_separator<char> els('\\',' ','\"');
|
||||||
|
std::string strCommand = command.toStdString();
|
||||||
|
boost::tokenizer<boost::escaped_list_separator<char> > tok(strCommand, els);
|
||||||
|
|
||||||
|
int n = 0;
|
||||||
|
for(boost::tokenizer<boost::escaped_list_separator<char> >::iterator beg=tok.begin(); beg!=tok.end();++beg,++n)
|
||||||
|
{
|
||||||
|
if(n == 0) // First parameter is the command
|
||||||
|
strMethod = *beg;
|
||||||
|
else
|
||||||
|
strParams.push_back(*beg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(boost::escaped_list_error &e)
|
||||||
{
|
{
|
||||||
if(n == 0) // First parameter is the command
|
emit reply(RPCConsole::CMD_ERROR, QString("Parse error"));
|
||||||
strMethod = *beg;
|
return;
|
||||||
else
|
|
||||||
strParams.push_back(*beg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user