Index: chrome/browser/automation/testing_automation_provider_win.cc |
=================================================================== |
--- chrome/browser/automation/testing_automation_provider_win.cc (revision 111826) |
+++ chrome/browser/automation/testing_automation_provider_win.cc (working copy) |
@@ -86,9 +86,10 @@ |
void TestingAutomationProvider::GetWindowTitle(int handle, string16* text) { |
gfx::NativeWindow window = window_tracker_->GetResource(handle); |
- std::wstring result; |
int length = ::GetWindowTextLength(window) + 1; |
- ::GetWindowText(window, WriteInto(&result, length), length); |
- text->assign(WideToUTF16(result)); |
+ if (length > 1) |
+ ::GetWindowText(window, WriteInto(text, length), length); |
+ else |
+ text->clear(); |
} |