Merge pull request #8922 from pchote/fix-tabcomplete-crash

Fix a divide by zero crash in TabCompletionLogic.
This commit is contained in:
Pavel Penev
2015-08-04 00:44:50 +03:00

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (string.IsNullOrWhiteSpace(text)) if (string.IsNullOrWhiteSpace(text))
return text; return text;
if (lastCompleted == text) if (lastCompleted == text && candidates.Any())
{ {
lastCompleted = prefix + candidates[++currentCandidateIndex % candidates.Count] + suffix; lastCompleted = prefix + candidates[++currentCandidateIndex % candidates.Count] + suffix;
return lastCompleted; return lastCompleted;