Skip to content

Commit

Permalink
use ??=
Browse files Browse the repository at this point in the history
  • Loading branch information
JerryImMouse committed Jul 14, 2024
1 parent 8616984 commit 30cdeee
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Hypercube.Client/Entities/Systems/Sprite/SpriteSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ private void OnRenderDrawing(ref RenderDrawingEvent ev)

public void Render(Entity<SpriteComponent> entity, Transform2 transform)
{
if (entity.Component.TextureHandle == null)
entity.Component.TextureHandle =
_resourceCacher.GetResource<TextureResource>(entity.Component.TexturePath).Texture ?? throw new NullReferenceException();

entity.Component.TextureHandle ??=
_resourceCacher.GetResource<TextureResource>(entity.Component.TexturePath).Texture;
_drawing.DrawTexture(entity.Component.TextureHandle, Vector2.Zero, entity.Component.Color, transform.Matrix * entity.Component.Transform.Matrix);
}
}

0 comments on commit 30cdeee

Please sign in to comment.