Ensure associated item search does not search for whitespace

This commit is contained in:
berichan
2021-02-26 18:09:33 +00:00
parent 9486fdc05d
commit 6ab6375ce6

View File

@@ -214,16 +214,17 @@ private static string GetItemName60000(ushort index)
/// <returns>Map of ItemID, ItemName</returns>
public List<ComboItem> GetAssociatedItems(ushort id, out string baseItemName)
{
baseItemName = string.Empty;
var stringMatch = GetItemName(id);
var index = stringMatch.IndexOf('(');
if (index < 0)
{
baseItemName = string.Empty;
return new List<ComboItem>();
}
var search = baseItemName = stringMatch.Substring(0, index);
return ItemDataSource.FindAll(x => x.Text.StartsWith(search));
if (!string.IsNullOrWhiteSpace(search))
return ItemDataSource.FindAll(x => x.Text.StartsWith(search));
else
return new List<ComboItem>();
}
}