diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-27 22:10:23 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-27 22:10:23 +0000 |
commit | 74f0ef5dcbfa1bc4d78fae41e6aeb444fa4a192a (patch) | |
tree | 430ab92eff5eff0841a981632fb4cf455632d9f4 /chrome/plugin | |
parent | b0dcda83e93df1a8d2162ba3d3b345d051f3d1a3 (diff) | |
download | chromium_src-74f0ef5dcbfa1bc4d78fae41e6aeb444fa4a192a.zip chromium_src-74f0ef5dcbfa1bc4d78fae41e6aeb444fa4a192a.tar.gz chromium_src-74f0ef5dcbfa1bc4d78fae41e6aeb444fa4a192a.tar.bz2 |
Add NULL-checks to plugin delegate message handlers
The handlers for messages that originate from render_view, rather than being results of actions started by the plugin itself, can't assume that plugin initialization succeeded.
BUG=57085
TEST=Plugins that don't load shouldn't crash.
Review URL: http://codereview.chromium.org/3404024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60712 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r-- | chrome/plugin/webplugin_delegate_stub.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc index 8e74aa7..17f0222 100644 --- a/chrome/plugin/webplugin_delegate_stub.cc +++ b/chrome/plugin/webplugin_delegate_stub.cc @@ -337,29 +337,35 @@ void WebPluginDelegateStub::OnSendJavaScriptStream(const GURL& url, } void WebPluginDelegateStub::OnSetContentAreaFocus(bool has_focus) { - delegate_->SetContentAreaHasFocus(has_focus); + if (delegate_) + delegate_->SetContentAreaHasFocus(has_focus); } #if defined(OS_MACOSX) void WebPluginDelegateStub::OnSetWindowFocus(bool has_focus) { - delegate_->SetWindowHasFocus(has_focus); + if (delegate_) + delegate_->SetWindowHasFocus(has_focus); } void WebPluginDelegateStub::OnContainerHidden() { - delegate_->SetContainerVisibility(false); + if (delegate_) + delegate_->SetContainerVisibility(false); } void WebPluginDelegateStub::OnContainerShown(gfx::Rect window_frame, gfx::Rect view_frame, bool has_focus) { - delegate_->WindowFrameChanged(window_frame, view_frame); - delegate_->SetContainerVisibility(true); - delegate_->SetWindowHasFocus(has_focus); + if (delegate_) { + delegate_->WindowFrameChanged(window_frame, view_frame); + delegate_->SetContainerVisibility(true); + delegate_->SetWindowHasFocus(has_focus); + } } void WebPluginDelegateStub::OnWindowFrameChanged(const gfx::Rect& window_frame, const gfx::Rect& view_frame) { - delegate_->WindowFrameChanged(window_frame, view_frame); + if (delegate_) + delegate_->WindowFrameChanged(window_frame, view_frame); } #endif // OS_MACOSX |