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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 8417004: OmniboxView: Attempt to fix a crash in GetSelectedText(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 9 years, 2 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/ui/views/omnibox/omnibox_view_win.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
index 806cd51e3d1e9bffe39848c063d83bac3d50d247..089503d2f4d8c4649f20e9c175551ab31e40b9d6 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc
@@ -611,6 +611,9 @@ void OmniboxViewWin::OpenMatch(const AutocompleteMatch& match,
string16 OmniboxViewWin::GetText() const {
const int len = GetTextLength() + 1;
+ if (len <= 1)
+ return string16();
+
string16 str;
GetWindowText(WriteInto(&str, len), len);
return str;
@@ -2109,6 +2112,8 @@ string16 OmniboxViewWin::GetSelectedText() const {
// Figure out the length of the selection.
CHARRANGE sel;
GetSel(sel);
+ if (sel.cpMin == sel.cpMax) // GetSelText() crashes on NULL input.
+ return string16();
// Grab the selected text.
string16 str;
« 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