summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents/tab_contents.cc
diff options
context:
space:
mode:
authorandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-16 23:50:51 +0000
committerandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-16 23:50:51 +0000
commitebd0eae7d02753d5ec82a22c13a5f16d1ca23700 (patch)
treea13b8e5802695d760098f0ef138d5aeac3de5f6d /chrome/browser/tab_contents/tab_contents.cc
parent3263b45534a37c63cbc6d43506cf8cd9bb30bbef (diff)
downloadchromium_src-ebd0eae7d02753d5ec82a22c13a5f16d1ca23700.zip
chromium_src-ebd0eae7d02753d5ec82a22c13a5f16d1ca23700.tar.gz
chromium_src-ebd0eae7d02753d5ec82a22c13a5f16d1ca23700.tar.bz2
Adds a NULL check for the RenderViewHost pointer within TabContents::ExecuteCode since render_view_host() can return NULL when a tab has crashed (or in some other edge cases).
BUG=34778 TEST=none Review URL: http://codereview.chromium.org/612002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39159 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/tab_contents.cc')
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 9d3ab59..001f26d 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -882,10 +882,13 @@ bool TabContents::ExecuteCode(int request_id, const std::string& extension_id,
const std::vector<URLPattern>& host_permissions,
bool is_js_code, const std::string& code_string,
bool all_frames) {
- return render_view_host()->Send(
- new ViewMsg_ExecuteCode(render_view_host()->routing_id(),
- ViewMsg_ExecuteCode_Params(request_id, extension_id, host_permissions,
- is_js_code, code_string, all_frames)));
+ RenderViewHost* host = render_view_host();
+ if (!host)
+ return false;
+
+ return host->Send(new ViewMsg_ExecuteCode(host->routing_id(),
+ ViewMsg_ExecuteCode_Params(request_id, extension_id, host_permissions,
+ is_js_code, code_string, all_frames)));
}
void TabContents::PopupNotificationVisibilityChanged(bool visible) {