diff options
Diffstat (limited to 'protocols/JabberG/src/jabber_util.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_util.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index ec6197c78a..dea5b49ff7 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -1000,14 +1000,15 @@ void JabberCopyText(HWND hwnd, const TCHAR *text) {
if (!hwnd || !text) return;
- OpenClipboard(hwnd);
- EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(text) + 1));
- TCHAR *s = (TCHAR *)GlobalLock(hMem);
- mir_tstrcpy(s, text);
- GlobalUnlock(hMem);
- SetClipboardData(CF_UNICODETEXT, hMem);
- CloseClipboard();
+ if (OpenClipboard(hwnd)) {
+ EmptyClipboard();
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(text) + 1));
+ TCHAR *s = (TCHAR *)GlobalLock(hMem);
+ mir_tstrcpy(s, text);
+ GlobalUnlock(hMem);
+ SetClipboardData(CF_UNICODETEXT, hMem);
+ CloseClipboard();
+ }
}
BOOL CJabberProto::EnterString(CMString &result, LPCTSTR caption, int type, char *windowName, int recentCount, int timeout)
|