diff --git a/osu.Game/Overlays/SkinEditor/SkinEditor.cs b/osu.Game/Overlays/SkinEditor/SkinEditor.cs
index ae831f4d66..8177c31058 100644
--- a/osu.Game/Overlays/SkinEditor/SkinEditor.cs
+++ b/osu.Game/Overlays/SkinEditor/SkinEditor.cs
@@ -353,12 +353,18 @@ namespace osu.Game.Overlays.SkinEditor
placeComponent(component);
}
- private void placeComponent(ISerialisableDrawable component, bool applyDefaults = true)
+ ///
+ /// Attempt to place a given component in the current target.
+ ///
+ /// The component to be placed.
+ /// Whether to apply default anchor / origin / position values.
+ /// Whether placement succeeded. Could fail if no target is available, or if the current target has missing dependency requirements for the component.
+ private bool placeComponent(ISerialisableDrawable component, bool applyDefaults = true)
{
var targetContainer = getFirstTarget();
if (targetContainer == null)
- return;
+ return false;
var drawableComponent = (Drawable)component;
@@ -370,10 +376,19 @@ namespace osu.Game.Overlays.SkinEditor
drawableComponent.Y = targetContainer.DrawSize.Y / 2;
}
- targetContainer.Add(component);
+ try
+ {
+ targetContainer.Add(component);
+ }
+ catch
+ {
+ // May fail if dependencies are not available, for instance.
+ return false;
+ }
SelectedComponents.Clear();
SelectedComponents.Add(component);
+ return true;
}
private void populateSettings()