mirror of https://github.com/ppy/osu
Fix SkinnableSprite initialising a drawable even when the texture is not available
This commit is contained in:
parent
72a15ef2dc
commit
9d0a6de26e
|
@ -24,7 +24,15 @@ public SkinnableSprite(string textureName, Func<ISkinSource, bool> allowFallback
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
private class SpriteComponent : ISkinComponent
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue