1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00

Merge pull request #8958 from smoogipoo/fix-ss-nullref

Fix potential nullref in song select filtering
This commit is contained in:
Dean Herbert 2020-05-08 09:08:03 +09:00 committed by GitHub
commit a019b5e6e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -149,6 +149,11 @@ namespace osu.Game.Beatmaps
}
}
public string[] SearchableTerms => new[]
{
Version
}.Concat(Metadata?.SearchableTerms ?? Enumerable.Empty<string>()).Where(s => !string.IsNullOrEmpty(s)).ToArray();
public override string ToString()
{
string version = string.IsNullOrEmpty(Version) ? string.Empty : $"[{Version}]";

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Screens.Select.Filter;
@ -55,10 +54,7 @@ namespace osu.Game.Screens.Select.Carousel
if (match)
{
var terms = new List<string>();
terms.AddRange(Beatmap.Metadata.SearchableTerms);
terms.Add(Beatmap.Version);
var terms = Beatmap.SearchableTerms;
foreach (var criteriaTerm in criteria.SearchTerms)
match &= terms.Any(term => term.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0);