Avoid division by zero when the imagelist is created with a width of

zero (ie no images).
This commit is contained in:
Mike Hearn 2003-08-29 22:10:25 +00:00 committed by Alexandre Julliard
parent 919bd7855f
commit b79fc16577

View file

@ -284,7 +284,10 @@ ImageList_AddMasked (HIMAGELIST himl, HBITMAP hBitmap, COLORREF clrMask)
if (!GetObjectA (hBitmap, sizeof(BITMAP), &bmp))
return -1;
nImageCount = bmp.bmWidth / himl->cx;
if (himl->cx > 0)
nImageCount = bmp.bmWidth / himl->cx;
else
nImageCount = 0;
IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight);