Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Unified Diff: chrome/browser/android/dev_tools_server.cc

Issue 542953002: Do NULL checks on TabAndroids retrieved from the model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: style Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/dev_tools_server.cc
diff --git a/chrome/browser/android/dev_tools_server.cc b/chrome/browser/android/dev_tools_server.cc
index af04acca20aa0553408bfe9a1b6af787dc956523..e41b65f943af41f471c4532c0a51ea29e65eb2a8 100644
--- a/chrome/browser/android/dev_tools_server.cc
+++ b/chrome/browser/android/dev_tools_server.cc
@@ -188,6 +188,9 @@ class TabTarget : public TargetBase {
if (!web_contents) {
// The tab has been pushed out of memory, pull it back.
TabAndroid* tab = model->GetTabAt(index);
+ if (!tab)
+ return NULL;
+
tab->LoadIfNeeded();
web_contents = model->GetWebContentsAt(index);
if (!web_contents)
@@ -231,7 +234,7 @@ class TabTarget : public TargetBase {
TabModel* model = *iter;
for (int i = 0; i < model->GetTabCount(); ++i) {
TabAndroid* tab = model->GetTabAt(i);
- if (tab->GetAndroidId() == tab_id_) {
+ if (tab && tab->GetAndroidId() == tab_id_) {
*model_result = model;
*index_result = i;
return true;
@@ -363,6 +366,9 @@ class DevToolsServerDelegate : public content::DevToolsHttpHandlerDelegate {
TabModel* model = *iter;
for (int i = 0; i < model->GetTabCount(); ++i) {
TabAndroid* tab = model->GetTabAt(i);
+ if (!tab)
+ continue;
+
WebContents* web_contents = model->GetWebContentsAt(i);
if (web_contents) {
tab_web_contents.insert(web_contents);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698