summaryrefslogtreecommitdiff
path: root/plugins/CrashDumper/src/crshdmp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/CrashDumper/src/crshdmp.cpp')
-rw-r--r--plugins/CrashDumper/src/crshdmp.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp
index 53a0a5a389..ccc560205a 100644
--- a/plugins/CrashDumper/src/crshdmp.cpp
+++ b/plugins/CrashDumper/src/crshdmp.cpp
@@ -158,21 +158,23 @@ INT_PTR OpenUrl(WPARAM wParam, LPARAM)
INT_PTR CopyLinkToClipboard(WPARAM, LPARAM)
{
- TCHAR *tmp;
- TCHAR buffer[MAX_PATH];
-
- tmp = db_get_wsa(NULL, PluginName, "Username");
- mir_sntprintf(buffer, SIZEOF(buffer), _T("http://vi.miranda-ng.org/detail/%s"), tmp);
- int bufLen = (sizeof(buffer) + 1) * sizeof(TCHAR);
- HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, bufLen);
- LPSTR buf = (LPSTR)GlobalLock(hData);
- memcpy(buf, buffer, bufLen);
-
- OpenClipboard(NULL);
- EmptyClipboard();
-
- SetClipboardData(CF_UNICODETEXT, hData);
- CloseClipboard();
+ ptrT tmp(db_get_wsa(NULL, PluginName, "Username"));
+ if (tmp != NULL) {
+ TCHAR buffer[MAX_PATH];
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("http://vi.miranda-ng.org/detail/%s"), tmp);
+
+ int bufLen = (sizeof(buffer) + 1) * sizeof(TCHAR);
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, bufLen);
+ LPSTR buf = (LPSTR)GlobalLock(hData);
+ memcpy(buf, buffer, bufLen);
+
+ OpenClipboard(NULL);
+ EmptyClipboard();
+
+ if (SetClipboardData(CF_UNICODETEXT, hData) == NULL)
+ GlobalFree(hData);
+ CloseClipboard();
+ }
return 0;
}