summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 19:55:39 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 19:55:39 +0000
commite7d1761ec4a007a3fc64d790ed22d015e99951de (patch)
treeb8e761f1494b7a4bc0f6f9db000b719577769c97
parent6447d9c4256ac5e4b212250edddb0b5ace417b63 (diff)
downloadchromium_src-e7d1761ec4a007a3fc64d790ed22d015e99951de.zip
chromium_src-e7d1761ec4a007a3fc64d790ed22d015e99951de.tar.gz
chromium_src-e7d1761ec4a007a3fc64d790ed22d015e99951de.tar.bz2
Fix a crash when GetOleInterface returns NULL. The replaced class, CComQIPtr, handles attaching to a NULL pointer, but ScopedComPtr does not, so check for a non-NULL ole_interface before calling QueryFrom.
BUG=22829 TEST=none Review URL: http://codereview.chromium.org/374012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31271 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--views/controls/textfield/native_textfield_win.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc
index 500ad72..cb7db37 100644
--- a/views/controls/textfield/native_textfield_win.cc
+++ b/views/controls/textfield/native_textfield_win.cc
@@ -100,7 +100,8 @@ NativeTextfieldWin::NativeTextfieldWin(Textfield* textfield)
// Set up the text_object_model_.
ScopedComPtr<IRichEditOle, &IID_IRichEditOle> ole_interface;
ole_interface.Attach(GetOleInterface());
- text_object_model_.QueryFrom(ole_interface);
+ if (ole_interface)
+ text_object_model_.QueryFrom(ole_interface);
}
NativeTextfieldWin::~NativeTextfieldWin() {
@@ -871,7 +872,8 @@ ITextDocument* NativeTextfieldWin::GetTextObjectModel() const {
if (!text_object_model_) {
ScopedComPtr<IRichEditOle, &IID_IRichEditOle> ole_interface;
ole_interface.Attach(GetOleInterface());
- text_object_model_.QueryFrom(ole_interface);
+ if (ole_interface)
+ text_object_model_.QueryFrom(ole_interface);
}
return text_object_model_;
}