diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-06-01 07:25:37 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-06-01 07:25:37 +0000 |
commit | 499c6dd7340130332361c3b873c8f1c5151d4028 (patch) | |
tree | 643cccc05ca63a8bb1d1a309cb5e1e3e98e8b867 /message_notify/messagenotify.cpp | |
parent | dc08107d59d2b1b4bbf840ab156876f52841e15e (diff) |
fix crash with no message text displayed
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@188 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'message_notify/messagenotify.cpp')
-rw-r--r-- | message_notify/messagenotify.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/message_notify/messagenotify.cpp b/message_notify/messagenotify.cpp index f5de3e3..fe37a28 100644 --- a/message_notify/messagenotify.cpp +++ b/message_notify/messagenotify.cpp @@ -27,7 +27,7 @@ DWORD focusTimerId = 0; PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
"Message Notify",
- PLUGIN_MAKE_VERSION(0,2,0,1),
+ PLUGIN_MAKE_VERSION(0,2,0,3),
"Show a popup when a message is received",
"Scott Ellis",
"mail@scottellis.com.au",
@@ -197,21 +197,23 @@ unsigned int __stdcall sttCheckWindowProc( VOID *dwParam ) { }
}
- wchar_t *msg;
- int msglen = strlen((char *)cd->blob) + 1;
+ wchar_t *msg = 0;
// does blob contain unicode message?
- if(msglen != cd->blobsize && wcslen((wchar_t *)(&cd->blob[msglen]))) {
- // yes
- msg = (wchar_t *)(&cd->blob[msglen]);
- ShowPopupW(cd->hContact, swzContactDisplayName, msg);
- } else if(cd->blobsize) {
- // no, convert to unciode
- int size = MultiByteToWideChar(code_page, 0, (char *) cd->blob, -1, 0, 0);
- msg = (wchar_t *) malloc(sizeof(wchar_t) * size);
- MultiByteToWideChar(code_page, 0, (char *) cd->blob, -1, msg, size);
- ShowPopupW(cd->hContact, swzContactDisplayName, msg);
- free(msg);
+ if(cd->blobsize) {
+ int msglen = strlen((char *)cd->blob) + 1;
+ if(msglen != cd->blobsize && wcslen((wchar_t *)(&cd->blob[msglen]))) {
+ // yes
+ msg = (wchar_t *)(&cd->blob[msglen]);
+ ShowPopupW(cd->hContact, swzContactDisplayName, msg);
+ } else {
+ // no, convert to unciode
+ int size = MultiByteToWideChar(code_page, 0, (char *) cd->blob, -1, 0, 0);
+ msg = (wchar_t *) malloc(sizeof(wchar_t) * size);
+ MultiByteToWideChar(code_page, 0, (char *) cd->blob, -1, msg, size);
+ ShowPopupW(cd->hContact, swzContactDisplayName, msg);
+ free(msg);
+ }
} else { // no message
ShowPopupW(cd->hContact, swzContactDisplayName, 0);
}
|