Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
=================================================================== |
--- chrome/browser/ui/views/omnibox/omnibox_view_win.cc (revision 107621) |
+++ chrome/browser/ui/views/omnibox/omnibox_view_win.cc (working copy) |
@@ -611,11 +611,9 @@ |
string16 OmniboxViewWin::GetText() const { |
const int len = GetTextLength() + 1; |
- if (len <= 1) |
- return string16(); |
- |
string16 str; |
- GetWindowText(WriteInto(&str, len), len); |
+ if (len > 1) |
+ GetWindowText(WriteInto(&str, len), len); |
return str; |
} |
@@ -2109,15 +2107,11 @@ |
} |
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; |
- GetSelText(WriteInto(&str, sel.cpMax - sel.cpMin + 1)); |
+ if (sel.cpMin != sel.cpMax) |
+ GetSelText(WriteInto(&str, sel.cpMax - sel.cpMin + 1)); |
return str; |
} |