From 38d72d981a03b8b775c0b01874d3f4e10e3de434 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 25 Aug 2019 21:58:01 +0200 Subject: [PATCH] removed null propagation here because I never really use it anywhere else and it's ugly --- MLEM.Ui/UiSystem.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MLEM.Ui/UiSystem.cs b/MLEM.Ui/UiSystem.cs index ad4ebff..d1b210b 100644 --- a/MLEM.Ui/UiSystem.cs +++ b/MLEM.Ui/UiSystem.cs @@ -97,10 +97,12 @@ namespace MLEM.Ui { } // first action on element - mousedNow?.OnPressed?.Invoke(mousedNow); + if (mousedNow != null) + mousedNow.OnPressed?.Invoke(mousedNow); } else if (this.InputHandler.IsMouseButtonPressed(this.SecondaryButton)) { // secondary action on element - mousedNow?.OnSecondaryPressed?.Invoke(mousedNow); + if (mousedNow != null) + mousedNow.OnSecondaryPressed?.Invoke(mousedNow); } // generic element click