summaryrefslogtreecommitdiff
path: root/plugins/WhenWasIt
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-06-11 13:02:17 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-06-11 13:02:17 +0000
commit7a3c245b5c333a40a723e1ab2196727e161b7338 (patch)
tree4c234d06697929259c649ac764517453ae73b6db /plugins/WhenWasIt
parentd2cd00d07cd8c97a3276e47803a1e5bfb10bd60a (diff)
fix for a crash in WhenWasIt
fixes: #369 git-svn-id: http://svn.miranda-ng.org/main/trunk@4914 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/WhenWasIt')
-rw-r--r--plugins/WhenWasIt/src/dlg_handlers.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp
index 92817875f7..bb82b06974 100644
--- a/plugins/WhenWasIt/src/dlg_handlers.cpp
+++ b/plugins/WhenWasIt/src/dlg_handlers.cpp
@@ -572,10 +572,7 @@ INT_PTR CALLBACK BirthdaysCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam
//only updates the birthday part of the list view entry. Won't update the szProto and the contact name (those shouldn't change anyway :))
int UpdateBirthdayEntry(HWND hList, HANDLE hContact, int entry, int bShowAll, int bShowCurrentAge, int bAdd)
{
- int currentYear;
- int currentMonth;
- int currentDay;
-
+ int currentMonth, currentDay;
int res = entry;
if (bShowCurrentAge) {
@@ -583,7 +580,6 @@ int UpdateBirthdayEntry(HWND hList, HANDLE hContact, int entry, int bShowAll, in
struct tm *today = gmtime(&now);
currentDay = today->tm_mday + 1;
currentMonth = today->tm_mon + 1;
- currentYear = today->tm_year;
}
int year, month, day;
@@ -598,21 +594,21 @@ int UpdateBirthdayEntry(HWND hList, HANDLE hContact, int entry, int bShowAll, in
char *szProto = GetContactProto(hContact);
PROTOACCOUNT *pAcc = ProtoGetAccount(szProto);
+ TCHAR *ptszAccName = (pAcc == NULL) ? TranslateT("Unknown") : pAcc->tszAccountName;
LVITEM item = {0};
item.mask = LVIF_TEXT | LVIF_PARAM;
item.iItem = entry;
item.lParam = (LPARAM) hContact;
- item.pszText = pAcc->tszAccountName;
+ item.pszText = ptszAccName;
if (bAdd)
ListView_InsertItem(hList, &item);
else
- ListView_SetItemText(hList, entry, 0, pAcc->tszAccountName);
+ ListView_SetItemText(hList, entry, 0, ptszAccName);
- TCHAR *name = GetContactName(hContact, szProto);
+ ptrT name( GetContactName(hContact, szProto));
ListView_SetItemText(hList, entry, 1, name);
- free(name);
TCHAR buffer[2048];
if ((dtb <= 366) && (dtb >= 0))