Skip to content

Commit

Permalink
Initialise container earlier to avoid null reference failures
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Oct 23, 2024
1 parent 1e03bd1 commit 064aaeb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions osu.Game/Rulesets/UI/DrawableRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ public abstract partial class DrawableRuleset<TObject> : DrawableRuleset, IProvi
/// </summary>
public override Playfield Playfield => playfield.Value;

private PlayfieldAdjustmentContainer playfieldAdjustmentContainer;

public override PlayfieldAdjustmentContainer PlayfieldAdjustmentContainer => playfieldAdjustmentContainer;

public override Container Overlays { get; } = new Container { RelativeSizeAxes = Axes.Both };
Expand All @@ -79,6 +77,8 @@ public abstract partial class DrawableRuleset<TObject> : DrawableRuleset, IProvi

public override IFrameStableClock FrameStableClock => frameStabilityContainer;

private readonly PlayfieldAdjustmentContainer playfieldAdjustmentContainer;

private bool allowBackwardsSeeks;

public override bool AllowBackwardsSeeks
Expand Down Expand Up @@ -144,6 +144,7 @@ protected DrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod>
RelativeSizeAxes = Axes.Both;

KeyBindingInputManager = CreateInputManager();
playfieldAdjustmentContainer = CreatePlayfieldAdjustmentContainer();
playfield = new Lazy<Playfield>(() => CreatePlayfield().With(p =>
{
p.NewResult += (_, r) => NewResult?.Invoke(r);
Expand Down Expand Up @@ -195,8 +196,7 @@ private void load(CancellationToken? cancellationToken)
audioContainer.WithChild(KeyBindingInputManager
.WithChildren(new Drawable[]
{
playfieldAdjustmentContainer = CreatePlayfieldAdjustmentContainer()
.WithChild(Playfield),
playfieldAdjustmentContainer.WithChild(Playfield),
Overlays
})),
}
Expand Down

0 comments on commit 064aaeb

Please sign in to comment.