1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 20:58:34 +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> /// </summary>
public readonly Texture2D Texture; public readonly Texture2D Texture;
/// <summary> /// <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> /// </summary>
/// <param name="name">The region's name</param> /// <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> /// <summary>
/// Returns an enumerable of all of the <see cref="TextureRegion"/>s in this atlas. /// Returns an enumerable of all of the <see cref="TextureRegion"/>s in this atlas.
/// </summary> /// </summary>