1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Fix nullref exceptions and redundant explicit type

This commit is contained in:
Shivam 2020-06-24 02:13:28 +02:00
parent c32ef5e718
commit af11340849
3 changed files with 5 additions and 6 deletions

View File

@ -152,13 +152,13 @@ namespace osu.Game.Tests.NonVisual
Assert.That(!host.Storage.ExistsDirectory(Path.Combine("test-nested", "cache")));
Assert.That(storage.ExistsDirectory(Path.Combine("test-nested", "cache")));
foreach (var file in osuStorage.IgnoreFiles)
foreach (var file in osuStorage?.IgnoreFiles ?? Array.Empty<string>())
{
Assert.That(host.Storage.Exists(file), Is.True);
Assert.That(storage.Exists(file), Is.False);
}
foreach (var dir in osuStorage.IgnoreDirectories)
foreach (var dir in osuStorage?.IgnoreDirectories ?? Array.Empty<string>())
{
Assert.That(host.Storage.ExistsDirectory(dir), Is.True);
Assert.That(storage.ExistsDirectory(dir), Is.False);

View File

@ -30,8 +30,7 @@ namespace osu.Game.Tournament.Components
[BackgroundDependencyLoader]
private void load(Storage storage)
{
var tournamentStorage = storage as TournamentStorage;
var stream = tournamentStorage.VideoStore.GetStream(filename);
var stream = (storage as TournamentStorage)?.VideoStore.GetStream(filename);
if (stream != null)
{

View File

@ -14,8 +14,8 @@ namespace osu.Game.IO
/// </summary>
public abstract class MigratableStorage : WrappedStorage
{
internal virtual string[] IgnoreDirectories => new string[] { };
internal virtual string[] IgnoreFiles => new string[] { };
internal virtual string[] IgnoreDirectories => Array.Empty<string>();
internal virtual string[] IgnoreFiles => Array.Empty<string>();
protected MigratableStorage(Storage storage, string subPath = null)
: base(storage, subPath)