Fix external commands which take no arguments.

Fixes #5998
This commit is contained in:
Gunnar Beutner 2014-04-11 15:47:26 +02:00
parent c693f7fa20
commit cdda8d5734
1 changed files with 9 additions and 8 deletions

View File

@ -122,19 +122,20 @@ void ExternalCommandProcessor::Execute(double time, const String& command, const
std::vector<String> realArguments;
realArguments.resize(argnum);
if (arguments.size() > 0)
if (argnum > 0) {
std::copy(arguments.begin(), arguments.begin() + argnum - 1, realArguments.begin());
String last_argument;
for (int i = argnum - 1; i < arguments.size(); i++) {
if (!last_argument.IsEmpty())
last_argument += ";";
String last_argument;
for (int i = argnum - 1; i < arguments.size(); i++) {
if (!last_argument.IsEmpty())
last_argument += ";";
last_argument += arguments[i];
last_argument += arguments[i];
}
realArguments[argnum - 1] = last_argument;
}
realArguments[argnum - 1] = last_argument;
OnNewExternalCommand(time, command, realArguments);
eci.Callback(time, realArguments);