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"));
}
}
}
}

View File

@@ -129,14 +129,6 @@ entities:
color: '#FFFFFFFF'
id: Grasse1
coordinates: 13.889501,-4.865914
10:
color: '#FFFFFFFF'
id: Rock08
coordinates: 3.2020006,-13.537788
11:
color: '#FFFFFFFF'
id: Rock10
coordinates: 5.9051256,-13.131538
12:
color: '#FFFFFFFF'
id: Flowersbr2