Fix an eventual crash and UDL empty button issue after changing language

The bug was inserted by the following commit:
4d217387f1

Fix #13228
pull/13310/head
Don Ho 2023-03-07 03:52:10 +01:00
parent 25be5dd3b6
commit 0b6a8e2011
1 changed files with 9 additions and 3 deletions

View File

@ -681,10 +681,16 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
HWND hItem = ::GetDlgItem(hDlg, id);
if (hItem)
{
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
if (id == IDC_DOCK_BUTTON && userDefineDlg->isDocked())
nameW = getAttrNameByIdStr(TEXT("Undock"), userDefineDlgNode, std::to_string(IDC_UNDOCK_BUTTON).c_str()).c_str();
::SetWindowText(hItem, nameW);
{
generic_string name = getAttrNameByIdStr(TEXT("Undock"), userDefineDlgNode, std::to_string(IDC_UNDOCK_BUTTON).c_str());
::SetWindowText(hItem, name.c_str());
}
else
{
const wchar_t *nameW = wmc.char2wchar(name, _nativeLangEncoding);
::SetWindowText(hItem, nameW);
}
}
}
}