From b5c2e7d08bcd3db16342940ea70f01c689e68f03 Mon Sep 17 00:00:00 2001 From: Anna Date: Tue, 16 Feb 2021 19:45:41 -0500 Subject: [PATCH] fix: don't show window until PF is initialised --- BetterPartyFinder/PluginUi.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/BetterPartyFinder/PluginUi.cs b/BetterPartyFinder/PluginUi.cs index f3893f0..4323a28 100755 --- a/BetterPartyFinder/PluginUi.cs +++ b/BetterPartyFinder/PluginUi.cs @@ -123,10 +123,14 @@ namespace BetterPartyFinder { var showWindow = this.Visible || addon?.Visible == true; if (!showWindow || !ImGui.Begin(this.Plugin.Name, ref this._visible)) { - if (ImGui.IsWindowCollapsed()) { - if (addon != null && addon.Visible) { - ImGui.SetWindowPos(new Vector2(addon.X, addon.Y - ImGui.GetFrameHeight())); + if (ImGui.IsWindowCollapsed() && addon != null && addon.Visible) { + // wait until addon is initialised to show + try { + _ = addon.Width; + } catch (NullReferenceException) { + return; } + ImGui.SetWindowPos(new Vector2(addon.X, addon.Y - ImGui.GetFrameHeight())); } return;