Commit 505aadb2 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(Cli): test correctly function name

parent b5be92e0
...@@ -105,13 +105,13 @@ void Cli::executeCommand (const QString &command) noexcept { ...@@ -105,13 +105,13 @@ void Cli::executeCommand (const QString &command) noexcept {
const QString Cli::parseFunctionName (const QString &command) noexcept { const QString Cli::parseFunctionName (const QString &command) noexcept {
mRegExpFunctionName.indexIn(command); mRegExpFunctionName.indexIn(command);
if (mRegExpFunctionName.pos(1) == -1) {
const QStringList texts = mRegExpFunctionName.capturedTexts();
if (texts.size() < 2) {
qWarning() << QStringLiteral("Unable to parse function name of command: `%1`.").arg(command); qWarning() << QStringLiteral("Unable to parse function name of command: `%1`.").arg(command);
return QString(""); return QString("");
} }
const QStringList texts = mRegExpFunctionName.capturedTexts();
const QString functionName = texts[1]; const QString functionName = texts[1];
if (!mCommands.contains(functionName)) { if (!mCommands.contains(functionName)) {
qWarning() << QStringLiteral("This command doesn't exist: `%1`.").arg(functionName); qWarning() << QStringLiteral("This command doesn't exist: `%1`.").arg(functionName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment