From 7a3c245b5c333a40a723e1ab2196727e161b7338 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 11 Jun 2013 13:02:17 +0000 Subject: fix for a crash in WhenWasIt fixes: #369 git-svn-id: http://svn.miranda-ng.org/main/trunk@4914 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/WhenWasIt/src/dlg_handlers.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'plugins') 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)) -- cgit v1.2.3