mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 09:42:54 +08:00
Add SafeSubmit extension for nullable command handler
This commit is contained in:
parent
b2276fbee7
commit
18f7321ac6
18
osu.Game/Screens/Edit/EditorCommandManagerExtension.cs
Normal file
18
osu.Game/Screens/Edit/EditorCommandManagerExtension.cs
Normal file
@ -0,0 +1,18 @@
|
||||
// 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.
|
||||
|
||||
using osu.Game.Screens.Edit.Commands;
|
||||
|
||||
namespace osu.Game.Screens.Edit
|
||||
{
|
||||
public static class EditorCommandManagerExtension
|
||||
{
|
||||
public static void SafeSubmit(this EditorCommandHandler? manager, IEditorCommand command, bool commitImmediately = false)
|
||||
{
|
||||
if (manager != null)
|
||||
manager.Submit(command, commitImmediately);
|
||||
else
|
||||
command.Apply();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user