From 30cdeeec5d9eae594e96c0e7190cb5b044394330 Mon Sep 17 00:00:00 2001 From: JerryImMouse Date: Sun, 14 Jul 2024 06:59:04 +0500 Subject: [PATCH] use ??= --- Hypercube.Client/Entities/Systems/Sprite/SpriteSystem.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Hypercube.Client/Entities/Systems/Sprite/SpriteSystem.cs b/Hypercube.Client/Entities/Systems/Sprite/SpriteSystem.cs index 36fc2c1..64bf90e 100644 --- a/Hypercube.Client/Entities/Systems/Sprite/SpriteSystem.cs +++ b/Hypercube.Client/Entities/Systems/Sprite/SpriteSystem.cs @@ -36,10 +36,8 @@ private void OnRenderDrawing(ref RenderDrawingEvent ev) public void Render(Entity entity, Transform2 transform) { - if (entity.Component.TextureHandle == null) - entity.Component.TextureHandle = - _resourceCacher.GetResource(entity.Component.TexturePath).Texture ?? throw new NullReferenceException(); - + entity.Component.TextureHandle ??= + _resourceCacher.GetResource(entity.Component.TexturePath).Texture; _drawing.DrawTexture(entity.Component.TextureHandle, Vector2.Zero, entity.Component.Color, transform.Matrix * entity.Component.Transform.Matrix); } } \ No newline at end of file