summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2013-05-20 15:10:07 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2013-05-20 15:10:07 +0000
commite941daea7a5ae68ba38d5e3524fa148022f64beb (patch)
tree6279e8e7ccc5c10ae1cd00a44a2b08bda80edf98 /plugins
parentbcf367e8b1d813c3a73dd2c8dcac12327d9a3200 (diff)
attempt to fix a crash
git-svn-id: http://svn.miranda-ng.org/main/trunk@4768 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NewXstatusNotify/src/main.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp
index 765bc23f4f..e4b78fa474 100644
--- a/plugins/NewXstatusNotify/src/main.cpp
+++ b/plugins/NewXstatusNotify/src/main.cpp
@@ -756,19 +756,24 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam)
WORD oldStatus = LOWORD(lParam);
WORD newStatus = HIWORD(lParam);
HANDLE hContact = (HANDLE)wParam;
- char buff[8], szProto[64], szSubProto[64];
bool bEnablePopup = true, bEnableSound = true;
char *hlpProto = GetContactProto(hContact);
if (hlpProto == NULL || opt.TempDisabled)
return 0;
+ char szProto[64];
strcpy(szProto, hlpProto);
WORD myStatus = (WORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0);
if (strcmp(szProto, szMetaModuleName) == 0) { //this contact is Meta
HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
- strcpy(szSubProto, GetContactProto(hSubContact));
+ hlpProto = GetContactProto(hSubContact);
+ if (hlpProto == NULL)
+ return 0;
+
+ char szSubProto[64];
+ strcpy(szSubProto, hlpProto);
if (newStatus == ID_STATUS_OFFLINE) {
// read last online proto for metaconatct if exists,
@@ -792,6 +797,7 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam)
}
if (!opt.FromOffline || oldStatus != ID_STATUS_OFFLINE) { // Either it wasn't a change from Offline or we didn't enable that.
+ char buff[8];
wsprintfA(buff, "%d", newStatus);
if (db_get_b(0, MODULE, buff, 1) == 0)
return 0; // "Notify when a contact changes to one of..." is unchecked
@@ -805,8 +811,8 @@ int ContactStatusChanged(WPARAM wParam, LPARAM lParam)
return 0;
// check if that proto from which we received statuschange notification, isn't in autodisable list
- char statusIDs[12], statusIDp[12];
if (opt.AutoDisable) {
+ char statusIDs[12], statusIDp[12];
wsprintfA(statusIDs, "s%d", myStatus);
wsprintfA(statusIDp, "p%d", myStatus);
bEnableSound = db_get_b(0, MODULE, statusIDs, 1) ? FALSE : TRUE;