Avoid mallocing zero bytes in the event log Copy processing, which

was apparently a problem for compilers other than Visual C. Thanks
to Roman Pompejus for pointing it out.

[originally from svn r918]
This commit is contained in:
Simon Tatham 2001-02-01 11:35:15 +00:00
Родитель 48699e8431
Коммит 4707d0823e
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -66,6 +66,11 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg,
int *selitems; int *selitems;
selcount = SendDlgItemMessage(hwnd, IDN_LIST, selcount = SendDlgItemMessage(hwnd, IDN_LIST,
LB_GETSELCOUNT, 0, 0); LB_GETSELCOUNT, 0, 0);
if (selcount == 0) { /* don't even try to copy zero items */
MessageBeep(0);
break;
}
selitems = smalloc(selcount * sizeof(int)); selitems = smalloc(selcount * sizeof(int));
if (selitems) { if (selitems) {
int count = SendDlgItemMessage(hwnd, IDN_LIST, int count = SendDlgItemMessage(hwnd, IDN_LIST,