From: Cheng Zhao Date: Thu, 15 Oct 2015 08:19:45 +0000 (+0800) Subject: views: Fix crash when setSizeConstrains is called early X-Git-Tag: v0.33.9~5^2~5 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=6aec8b092cf6c249649414d1c0a85f2a878bdd69;p=electron.git views: Fix crash when setSizeConstrains is called early --- diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 4c8d014b..e3688235 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -390,7 +390,10 @@ gfx::Size NativeWindowViews::GetContentSize() { void NativeWindowViews::SetContentSizeConstraints( const extensions::SizeConstraints& size_constraints) { NativeWindow::SetContentSizeConstraints(size_constraints); - window_->OnSizeConstraintsChanged(); + // widget_delegate() is only available after Init() is called, we make use of + // this to determine whether native widget has initialized. + if (window_ && window_->widget_delegate()) + window_->OnSizeConstraintsChanged(); #if defined(USE_X11) if (resizable_) old_size_constraints_ = size_constraints;