From bbbd69a789a4b4fa9c7af199bd903143701dc8f7 Mon Sep 17 00:00:00 2001 From: Zekka Date: Sat, 7 Jul 2018 23:05:06 -0700 Subject: [PATCH] Work around another Mono bug --- Labyrinth3/IDE/Controls/RTFPanel.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Labyrinth3/IDE/Controls/RTFPanel.cs b/Labyrinth3/IDE/Controls/RTFPanel.cs index bf6a622..2dff43c 100644 --- a/Labyrinth3/IDE/Controls/RTFPanel.cs +++ b/Labyrinth3/IDE/Controls/RTFPanel.cs @@ -273,9 +273,18 @@ public void UpdateUI() this.StrikeBtn.Pushed = this.ContentBox.SelectionFont.Strikeout; } this.BulletBtn.Pushed = this.ContentBox.SelectionBullet; - this.LeftBtn.Pushed = this.ContentBox.SelectionAlignment == HorizontalAlignment.Left; - this.CentreBtn.Pushed = this.ContentBox.SelectionAlignment == HorizontalAlignment.Center; - this.RightBtn.Pushed = this.ContentBox.SelectionAlignment == HorizontalAlignment.Right; + try + { + this.LeftBtn.Pushed = this.ContentBox.SelectionAlignment == HorizontalAlignment.Left; + this.CentreBtn.Pushed = this.ContentBox.SelectionAlignment == HorizontalAlignment.Center; + this.RightBtn.Pushed = this.ContentBox.SelectionAlignment == HorizontalAlignment.Right; + } + catch (NullReferenceException e) + { // this feature is bugged in Mono so pick a default + this.LeftBtn.Pushed = true; + this.CentreBtn.Pushed = false; + this.RightBtn.Pushed = false; + } this.UnindentBtn.Enabled = this.ContentBox.SelectionIndent > 0; this.IndentBtn.Enabled = true; }