From 1ff766a19958634507fdfa90fc7ed69c64389558 Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Tue, 15 Oct 2019 17:56:56 -0400 Subject: [PATCH] Try to fix potential cast issue if renderer does not apply on certain themes --- Switch_Toolbox_Library/Forms/Custom/STContextMenuStrip.cs | 4 ++-- Switch_Toolbox_Library/Forms/Custom/STToolStrip.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Switch_Toolbox_Library/Forms/Custom/STContextMenuStrip.cs b/Switch_Toolbox_Library/Forms/Custom/STContextMenuStrip.cs index 775f2e58..83fef31b 100644 --- a/Switch_Toolbox_Library/Forms/Custom/STContextMenuStrip.cs +++ b/Switch_Toolbox_Library/Forms/Custom/STContextMenuStrip.cs @@ -37,13 +37,13 @@ namespace Toolbox.Library.Forms public bool HighlightSelectedTab { get { - if (Renderer == null) + if (Renderer == null || !(Renderer is MenuRenderer)) return false; return ((MenuRenderer)this.Renderer).HighlightMenuBar; } set { - if (Renderer != null) + if (Renderer == null || !(Renderer is MenuRenderer)) ((MenuRenderer)this.Renderer).HighlightMenuBar = value; } } diff --git a/Switch_Toolbox_Library/Forms/Custom/STToolStrip.cs b/Switch_Toolbox_Library/Forms/Custom/STToolStrip.cs index bf70c913..508c84cf 100644 --- a/Switch_Toolbox_Library/Forms/Custom/STToolStrip.cs +++ b/Switch_Toolbox_Library/Forms/Custom/STToolStrip.cs @@ -33,14 +33,14 @@ namespace Toolbox.Library.Forms { get { - if (Renderer == null) + if (Renderer == null || !(Renderer is MenuRenderer)) return false; return ((MenuRenderer)this.Renderer).HighlightMenuBar; } set { - if (Renderer != null) + if (Renderer != null || !(Renderer is MenuRenderer)) ((MenuRenderer)this.Renderer).HighlightMenuBar = value; } }