diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java index 3778e9fbd..977213be6 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java @@ -238,13 +238,11 @@ public void closeWindow(@NonNull WindowWidget aWindow) { if (leftWindow == aWindow) { removeWindow(leftWindow); if (mFocusedWindow == leftWindow) { - mFocusedWindow = null; focusWindow(frontWindow); } } else if (rightWindow == aWindow) { removeWindow(rightWindow); if (mFocusedWindow == rightWindow) { - mFocusedWindow = null; focusWindow(frontWindow); } } else if (frontWindow == aWindow) { @@ -256,7 +254,6 @@ public void closeWindow(@NonNull WindowWidget aWindow) { } if (mFocusedWindow == frontWindow && !getCurrentWindows().isEmpty()) { - mFocusedWindow = null; focusWindow(getFrontWindow()); } @@ -319,7 +316,7 @@ public void focusWindow(@NonNull WindowWidget aWindow) { if (aWindow != mFocusedWindow) { WindowWidget prev = mFocusedWindow; mFocusedWindow = aWindow; - if (prev != null) { + if (prev != null && getCurrentWindows().contains(prev)) { prev.setActiveWindow(false); if (prev.isVisible()) { prev.getTitleBar().setVisible(true);