Fixed crashing when entering a space in the console and then attempting to autocomplete. Closes #977
This commit is contained in:
@@ -1833,7 +1833,7 @@ namespace Barotrauma
|
|||||||
string[] args = splitCommand.Skip(1).ToArray();
|
string[] args = splitCommand.Skip(1).ToArray();
|
||||||
|
|
||||||
//if an argument is given or the last character is a space, attempt to autocomplete the argument
|
//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]));
|
Command matchingCommand = commands.Find(c => c.names.Contains(splitCommand[0]));
|
||||||
if (matchingCommand == null || matchingCommand.GetValidArgs == null) return command;
|
if (matchingCommand == null || matchingCommand.GetValidArgs == null) return command;
|
||||||
|
|||||||
Reference in New Issue
Block a user