From 21ba9918905c5f3f66e3a075944587618da2d52d Mon Sep 17 00:00:00 2001 From: "sky@google.com" Date: Fri, 21 Nov 2008 20:24:09 +0000 Subject: Fixes possible crash in creating Browser. The crash could happen because its possible for the browserwindow to be null when SaveWindowPlacement is invoked (when the browserwindow is initially created). If the SessionService ends up asking the browser for the browserwindow it would get null and crash. BUG=4666 TEST=no direct way to test this as its rather random. But make sure you don't encounter any problems with session restore. Review URL: http://codereview.chromium.org/11567 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5844 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/browser.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'chrome') diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 375f566..262bc44 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -324,6 +324,11 @@ bool Browser::ShouldSaveWindowPlacement() const { } void Browser::SaveWindowPlacement(const gfx::Rect& bounds, bool maximized) { + if (!window_) { + // It is possible for this to be invoked during construction of the window, + // in which case window_ is NULL. + return; + } // Save to the session storage service, used when reloading a past session. // Note that we don't want to be the ones who cause lazy initialization of // the session service. This function gets called during initial window -- cgit v1.1