aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-05-12 18:14:29 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2012-05-12 18:39:26 +0200
commitae744c8b78a78a21cd44e10b65a600ff0c07d250 (patch)
tree31002ec5ceea502fe011b8e63875f1d74ec4864e /src/qt
parentc6aa86afc2fe8995bcb1036c9879f85ef335e295 (diff)
RPC console: don't crash on invalid input exception
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/rpcconsole.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 0f78288542..33b09952b7 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -55,19 +55,26 @@ void RPCExecutor::start()
void RPCExecutor::request(const QString &command)
{
// 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::vector<std::string> strParams;
- int n = 0;
- for(boost::tokenizer<boost::escaped_list_separator<char> >::iterator beg=tok.begin(); beg!=tok.end();++beg,++n)
+ try {
+ 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
- strMethod = *beg;
- else
- strParams.push_back(*beg);
+ emit reply(RPCConsole::CMD_ERROR, QString("Parse error"));
+ return;
}
try {