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

Unified Diff: chrome/browser/translate/translate_manager.cc

Issue 3341004: Bandaid around a weird crasher were we end up with a NULL infobar. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Style fix. Created 10 years, 4 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/translate/translate_manager.cc
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index 6330e7b0d24ffefb9c1df5c8d9ec14c948f0b506..36122e258115d28e37170084b9517821b1603e18 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -608,10 +608,16 @@ std::string TranslateManager::GetTargetLanguage() {
TranslateInfoBarDelegate* TranslateManager::GetTranslateInfoBarDelegate(
TabContents* tab) {
for (int i = 0; i < tab->infobar_delegate_count(); ++i) {
- TranslateInfoBarDelegate* delegate =
- tab->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate();
- if (delegate)
- return delegate;
+ InfoBarDelegate* delegate = tab->GetInfoBarDelegateAt(i);
+ if (!delegate) {
+ // Please let jcivelli know if you hit this and how you got to that point.
+ NOTREACHED();
+ continue;
+ }
+ TranslateInfoBarDelegate* translate_delegate =
+ delegate->AsTranslateInfoBarDelegate();
+ if (translate_delegate)
+ return translate_delegate;
}
return NULL;
}
« 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