From 7b056509ecf42a6233f14fe45ed21cc86b8cbfbb Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 1 Jan 2018 16:04:05 +0000 Subject: [PATCH] Don't try to remove tooltips that haven't been added. --- OpenRA.Mods.Common/Widgets/LabelWithTooltipWidget.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/LabelWithTooltipWidget.cs b/OpenRA.Mods.Common/Widgets/LabelWithTooltipWidget.cs index aad32cbcd8..614b6b3980 100644 --- a/OpenRA.Mods.Common/Widgets/LabelWithTooltipWidget.cs +++ b/OpenRA.Mods.Common/Widgets/LabelWithTooltipWidget.cs @@ -55,10 +55,10 @@ namespace OpenRA.Mods.Common.Widgets public override void MouseExited() { - if (TooltipContainer == null) - return; - - tooltipContainer.Value.RemoveTooltip(); + // Only try to remove the tooltip if we know it has been created + // This avoids a crash if the widget (and the container it refers to) are being removed + if (TooltipContainer != null && tooltipContainer.IsValueCreated) + tooltipContainer.Value.RemoveTooltip(); } } }