Fixed crashing when entering a space in the console and then attempting to autocomplete. Closes #977

This commit is contained in:
Joonas Rikkonen
2018-12-27 22:28:21 +02:00
parent 12aebf3cc9
commit ccf32fea20

View File

@@ -1833,7 +1833,7 @@ namespace Barotrauma
string[] args = splitCommand.Skip(1).ToArray();
//if an argument is given or the last character is a space, attempt to autocomplete the argument
if (args.Length > 0 || (command.Length > 0 && command.Last() == ' '))
if (args.Length > 0 || (splitCommand.Length > 0 && command.Last() == ' '))
{
Command matchingCommand = commands.Find(c => c.names.Contains(splitCommand[0]));
if (matchingCommand == null || matchingCommand.GetValidArgs == null) return command;