mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
make DataTextureAtlas not crash when a non-existent texture is queried
This commit is contained in:
parent
fe89fc24ea
commit
61e8b18403
1 changed files with 7 additions and 2 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue