1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-25 01:39:23 +01:00

make DataTextureAtlas not crash when a non-existent texture is queried

This commit is contained in:
Ellpeck 2020-07-24 00:39:04 +02:00
parent fe89fc24ea
commit 61e8b18403

View file

@ -19,10 +19,15 @@ namespace MLEM.Textures {
/// </summary>
public readonly Texture2D Texture;
/// <summary>
/// Returns the texture region with the given name.
/// Returns the texture region with the given name, or null if it does not exist.
/// </summary>
/// <param name="name">The region's name</param>
public TextureRegion this[string name] => this.regions[name];
public TextureRegion this[string name] {
get {
this.regions.TryGetValue(name, out var ret);
return ret;
}
}
/// <summary>
/// Returns an enumerable of all of the <see cref="TextureRegion"/>s in this atlas.
/// </summary>