mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Merge pull request #10889 from peppy/return-null-if-skinnable-sprite-no-exist
Fix SkinnableSprite initialising a drawable even when the texture is not available
This commit is contained in:
commit
9f6ca06039
@ -24,7 +24,15 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
}
|
||||
|
||||
protected override Drawable CreateDefault(ISkinComponent component) => new Sprite { Texture = textures.Get(component.LookupName) };
|
||||
protected override Drawable CreateDefault(ISkinComponent component)
|
||||
{
|
||||
var texture = textures.Get(component.LookupName);
|
||||
|
||||
if (texture == null)
|
||||
return null;
|
||||
|
||||
return new Sprite { Texture = texture };
|
||||
}
|
||||
|
||||
private class SpriteComponent : ISkinComponent
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user