Fix decal crash (#7484)

This commit is contained in:
Leon Friedrich
2022-04-10 03:36:24 +12:00
committed by GitHub
parent 93d89d7b62
commit 1317f0214a
2 changed files with 12 additions and 9 deletions

View File

@@ -56,7 +56,7 @@ namespace Content.Client.Decals
{
if (!cachedTextures.TryGetValue(decal.Id, out var texture))
{
var sprite = _prototypeManager.Index<DecalPrototype>(decal.Id).Sprite;
var sprite = GetDecalSprite(decal.Id);
texture = _sprites.Frame0(sprite);
cachedTextures[decal.Id] = texture;
}
@@ -69,5 +69,16 @@ namespace Content.Client.Decals
}
}
}
public SpriteSpecifier GetDecalSprite(string id)
{
if (_prototypeManager.TryIndex<DecalPrototype>(id, out var proto))
return proto.Sprite;
else
{
Logger.Error($"Unknown decal prototype: {id}");
return new SpriteSpecifier.Texture(new ResourcePath("/Textures/noSprite.png"));
}
}
}
}