Mark classes nullable

This commit is contained in:
Dean Herbert 2021-01-12 14:55:45 +09:00
parent 2e4c3c8e39
commit ff16d2f490
2 changed files with 18 additions and 11 deletions

View File

@ -3,15 +3,17 @@
using osu.Framework.Platform; using osu.Framework.Platform;
#nullable enable
namespace osu.Game.Database namespace osu.Game.Database
{ {
public abstract class RealmBackedStore public abstract class RealmBackedStore
{ {
protected readonly Storage Storage; protected readonly Storage? Storage;
protected readonly IRealmFactory ContextFactory; protected readonly IRealmFactory ContextFactory;
protected RealmBackedStore(IRealmFactory contextFactory, Storage storage = null) protected RealmBackedStore(IRealmFactory contextFactory, Storage? storage = null)
{ {
ContextFactory = contextFactory; ContextFactory = contextFactory;
Storage = storage; Storage = storage;

View File

@ -10,6 +10,8 @@ using osu.Game.Database;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Rulesets; using osu.Game.Rulesets;
#nullable enable
namespace osu.Game.Input namespace osu.Game.Input
{ {
public class RealmKeyBindingStore : RealmBackedStore public class RealmKeyBindingStore : RealmBackedStore
@ -17,10 +19,12 @@ namespace osu.Game.Input
/// <summary> /// <summary>
/// Fired whenever any key binding change occurs, across all rulesets and types. /// Fired whenever any key binding change occurs, across all rulesets and types.
/// </summary> /// </summary>
public event Action KeyBindingChanged; public event Action? KeyBindingChanged;
public RealmKeyBindingStore(RealmContextFactory contextFactory, RulesetStore rulesets, Storage storage = null) public RealmKeyBindingStore(RealmContextFactory contextFactory, RulesetStore? rulesets, Storage? storage = null)
: base(contextFactory, storage) : base(contextFactory, storage)
{
if (rulesets != null)
{ {
// populate defaults from rulesets. // populate defaults from rulesets.
using (ContextFactory.GetForWrite()) using (ContextFactory.GetForWrite())
@ -33,6 +37,7 @@ namespace osu.Game.Input
} }
} }
} }
}
/// <summary> /// <summary>
/// Retrieve all user-defined key combinations (in a format that can be displayed) for a specific action. /// Retrieve all user-defined key combinations (in a format that can be displayed) for a specific action.
@ -87,7 +92,7 @@ namespace osu.Game.Input
public void Update(IHasGuidPrimaryKey keyBinding, Action<IKeyBinding> modification) public void Update(IHasGuidPrimaryKey keyBinding, Action<IKeyBinding> modification)
{ {
// the incoming instance could already be a live access object. // the incoming instance could already be a live access object.
Live<RealmKeyBinding> realmBinding = keyBinding as Live<RealmKeyBinding>; Live<RealmKeyBinding>? realmBinding = keyBinding as Live<RealmKeyBinding>;
using (var realm = ContextFactory.GetForWrite()) using (var realm = ContextFactory.GetForWrite())
{ {