Skip to content

Commit

Permalink
fix: nullptr check when closing windows
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Apr 3, 2020
1 parent 1d15839 commit dbdc2bd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions shell/browser/window_list.cc
Expand Up @@ -84,16 +84,19 @@ void WindowList::CloseAllWindows() {
#if defined(OS_MACOSX)
std::reverse(windows.begin(), windows.end());
#endif
for (auto* const& window : windows)
if (!window->IsClosed())
for (auto* const& window : windows) {
if (window && !window->IsClosed())
window->Close();
}
}

// static
void WindowList::DestroyAllWindows() {
WindowVector windows = GetInstance()->windows_;
for (auto* const& window : windows)
window->CloseImmediately(); // e.g. Destroy()
for (auto* const& window : windows) {
if (window)
window->CloseImmediately();
}
}

WindowList::WindowList() = default;
Expand Down

0 comments on commit dbdc2bd

Please sign in to comment.