diff --git a/osu.Game/Input/RealmKeyBindingStore.cs b/osu.Game/Input/RealmKeyBindingStore.cs
index cd0b85cd8d..5b2d2c0dc1 100644
--- a/osu.Game/Input/RealmKeyBindingStore.cs
+++ b/osu.Game/Input/RealmKeyBindingStore.cs
@@ -87,14 +87,22 @@ namespace osu.Game.Input
/// The modification to apply to the key binding.
public void Update(IHasGuidPrimaryKey keyBinding, Action modification)
{
+ // the incoming instance could already be a live access object.
+ Live realmBinding = keyBinding as Live;
+
using (var realm = ContextFactory.GetForWrite())
{
- RealmKeyBinding realmBinding = keyBinding as RealmKeyBinding;
+ if (realmBinding == null)
+ {
+ // the incoming instance could be a raw realm object.
+ if (!(keyBinding is RealmKeyBinding rkb))
+ // if neither of the above cases succeeded, retrieve a realm object for further processing.
+ rkb = realm.Context.Find(keyBinding.ID);
- if (realmBinding?.IsManaged != true)
- realmBinding = realm.Context.Find(keyBinding.ID);
+ realmBinding = new Live(rkb, ContextFactory);
+ }
- modification(realmBinding);
+ realmBinding.PerformUpdate(modification);
}
KeyBindingChanged?.Invoke();