diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-17 21:40:05 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-17 21:40:05 +0000 |
commit | 87af4dc4a88de034e438cea03fd4122c2d391f82 (patch) | |
tree | 6180e387546869e66013967bc373954d038e3e54 /chrome | |
parent | c633a4968486f1b6bff7ff2dc9f6e0a73ef41402 (diff) | |
download | chromium_src-87af4dc4a88de034e438cea03fd4122c2d391f82.zip chromium_src-87af4dc4a88de034e438cea03fd4122c2d391f82.tar.gz chromium_src-87af4dc4a88de034e438cea03fd4122c2d391f82.tar.bz2 |
It's possible for GetOleInterface() to return NULL. Degrade gracefully in this case.
BUG=3906
Review URL: http://codereview.chromium.org/11213
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5576 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit.cc | 10 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit.h | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 680c851..6f0b5e1 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -2004,8 +2004,11 @@ void AutocompleteEditView::GetSelection(CHARRANGE& sel) const { GetSel(sel); // See if we need to reverse the direction of the selection. + ITextDocument* const text_object_model = GetTextObjectModel(); + if (!text_object_model) + return; CComPtr<ITextSelection> selection; - const HRESULT hr = GetTextObjectModel()->GetSelection(&selection); + const HRESULT hr = text_object_model->GetSelection(&selection); DCHECK(hr == S_OK); long flags; selection->GetFlags(&flags); @@ -2031,8 +2034,11 @@ void AutocompleteEditView::SetSelection(LONG start, LONG end) { return; // We need to reverse the direction of the selection. + ITextDocument* const text_object_model = GetTextObjectModel(); + if (!text_object_model) + return; CComPtr<ITextSelection> selection; - const HRESULT hr = GetTextObjectModel()->GetSelection(&selection); + const HRESULT hr = text_object_model->GetSelection(&selection); DCHECK(hr == S_OK); selection->SetFlags(tomSelStartActive); } diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h index 99309ef..07324701 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.h +++ b/chrome/browser/autocomplete/autocomplete_edit.h @@ -772,7 +772,8 @@ class AutocompleteEditView // Getter for the text_object_model_, used by the ScopedXXX classes. Note // that the pointer returned here is only valid as long as the - // AutocompleteEdit is still alive. + // AutocompleteEdit is still alive. Also, if the underlying call fails, this + // may return NULL. ITextDocument* GetTextObjectModel() const; // Invoked during a mouse move. As necessary starts a drag and drop session. |