From eae88388e2a74e1e554772f85f4b7acf201ed5e8 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 1 Feb 2001 11:35:15 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.tartarus.org/sgt/putty@918 cda61777-01e9-0310-a592-d414129be87e --- windlg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/windlg.c b/windlg.c index fb5740f5..d2ca6c0d 100644 --- a/windlg.c +++ b/windlg.c @@ -66,6 +66,11 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg, int *selitems; selcount = SendDlgItemMessage(hwnd, IDN_LIST, LB_GETSELCOUNT, 0, 0); + if (selcount == 0) { /* don't even try to copy zero items */ + MessageBeep(0); + break; + } + selitems = smalloc(selcount * sizeof(int)); if (selitems) { int count = SendDlgItemMessage(hwnd, IDN_LIST, -- 2.11.0