From b9651cb5c8d07a0cc851b2da4903dbdb1224bb63 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Fri, 25 Apr 2014 17:24:17 +0200 Subject: [PATCH] Check return value of GetWindowText() Based on TortoiseSVN rev. 25433. Signed-off-by: Sven Strickroth --- src/TortoiseUDiff/FindBar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TortoiseUDiff/FindBar.cpp b/src/TortoiseUDiff/FindBar.cpp index 99fcc70cf..05ec818da 100644 --- a/src/TortoiseUDiff/FindBar.cpp +++ b/src/TortoiseUDiff/FindBar.cpp @@ -87,7 +87,8 @@ void CFindBar::DoFind(bool bFindPrev) { int len = ::GetWindowTextLength(GetDlgItem(*this, IDC_FINDTEXT)); std::unique_ptr findtext(new TCHAR[len + 1]); - ::GetWindowText(GetDlgItem(*this, IDC_FINDTEXT), findtext.get(), len + 1); + if (!::GetWindowText(GetDlgItem(*this, IDC_FINDTEXT), findtext.get(), len + 1)) + return; std::wstring ft = std::wstring(findtext.get()); const bool bCaseSensitive = !!SendMessage(GetDlgItem(*this, IDC_MATCHCASECHECK), BM_GETCHECK, 0, NULL); const UINT message = bFindPrev ? COMMITMONITOR_FINDMSGPREV : COMMITMONITOR_FINDMSGNEXT; -- 2.11.4.GIT