mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 21:52:55 +08:00
Add exception to catch any incorrect defaults of Bindable<string>
This commit is contained in:
parent
42d3fe8f02
commit
2856aef4eb
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
@ -13,5 +15,17 @@ namespace osu.Game.Overlays.Settings
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
CommitOnFocusLost = true
|
CommitOnFocusLost = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public override Bindable<string> Current
|
||||||
|
{
|
||||||
|
get => base.Current;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value.Default == null)
|
||||||
|
throw new InvalidOperationException($"Bindable settings of type {nameof(Bindable<string>)} should have a non-null default value.");
|
||||||
|
|
||||||
|
base.Current = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user