Skip to content

Commit 5a04824

Browse files
committed
Fix an issue where typing only a single character in the header bar could cause a crash. (2)
1 parent 4de290f commit 5a04824

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Src/FilepathEdit.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,15 @@ BOOL CFilepathEdit::PreTranslateMessage(MSG *pMsg)
472472
SetBackColor(MakeBackColor(true, false));
473473
RedrawWindow(nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE);
474474
SetReadOnly();
475-
GetParent()->PostMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), EN_USER_CAPTION_CHANGED), (LPARAM)m_hWnd);
475+
CString text;
476+
GetWindowText(text);
477+
String orgtext = m_sOriginalText;
478+
if (!orgtext.empty() && orgtext[0] == '*')
479+
orgtext = orgtext.substr(2);
480+
if (text == orgtext.c_str())
481+
SetWindowText(m_sOriginalText.c_str());
482+
else
483+
GetParent()->PostMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), EN_USER_CAPTION_CHANGED), (LPARAM)m_hWnd);
476484
return TRUE;
477485
}
478486
if (pMsg->wParam == VK_ESCAPE)

0 commit comments

Comments
 (0)