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:
Dan Balasescu 2020-11-18 21:35:13 +09:00 committed by GitHub
commit 9f6ca06039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
{