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