diff --git a/Blish HUD/GameServices/GameIntegration/Gw2InstanceIntegration.cs b/Blish HUD/GameServices/GameIntegration/Gw2InstanceIntegration.cs index a6c172c6c..ec473bd57 100644 --- a/Blish HUD/GameServices/GameIntegration/Gw2InstanceIntegration.cs +++ b/Blish HUD/GameServices/GameIntegration/Gw2InstanceIntegration.cs @@ -164,6 +164,7 @@ private void HandleProcessUpdate(Process newProcess) { BlishHud.Instance.Form.Invoke((MethodInvoker)(() => { BlishHud.Instance.Form.Visible = false; })); _gw2Process = null; + this.Gw2IsRunning = false; } else { if (_gw2Process.MainModule != null) { _gw2ExecutablePath.Value = _gw2Process.MainModule.FileName; @@ -178,15 +179,14 @@ private void HandleProcessUpdate(Process newProcess) { } catch (NullReferenceException e) { Logger.Warn(e, "Failed to grab Guild Wars 2 env variable. It is likely exiting."); } - } - // GW2 is running if the "_gw2Process" isn't null and the class name of process' - // window is the game window name (so we know we are passed the login screen) - string windowClass = WindowUtil.GetClassNameOfWindow(this.Gw2Process.MainWindowHandle); + // GW2 is running if the "_gw2Process" isn't null and the class name of process' + // window is the game window name (so we know we are passed the login screen) + string windowClass = WindowUtil.GetClassNameOfWindow(_gw2Process.MainWindowHandle); - this.Gw2IsRunning = _gw2Process != null - && windowClass == ApplicationSettings.Instance.WindowName - || windowClass != GW2_PATCHWINDOW_CLASS; + this.Gw2IsRunning = windowClass == ApplicationSettings.Instance.WindowName + || windowClass != GW2_PATCHWINDOW_CLASS; + } } private void OnGameFocusChanged(object sender, ValueEventArgs e) {