Corrected a problem of when oldHit is negative and we try to use it as

an index into the buttons array.
This commit is contained in:
Aric Stewart 2000-05-23 04:10:45 +00:00 committed by Alexandre Julliard
parent 1789f24ed0
commit 9700b7fa55
1 changed files with 4 additions and 1 deletions

View File

@ -3242,6 +3242,9 @@ TOOLBAR_MouseLeave (HWND hwnd, WPARAM wParam, LPARAM lParam)
TOOLBAR_INFO *infoPtr = TOOLBAR_GetInfoPtr (hwnd);
TBUTTON_INFO *hotBtnPtr;
if (infoPtr->nOldHit < 0)
return TRUE;
hotBtnPtr = &infoPtr->buttons[infoPtr->nOldHit];
/* Redraw the button if the last button we were over is the hot button and it
@ -3299,7 +3302,7 @@ TOOLBAR_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
{
/* Remove the effect of an old hot button if the button was enabled and was
drawn with the hot button effect */
if(infoPtr->nOldHit == infoPtr->nHotItem &&
if(infoPtr->nOldHit >= 0 && infoPtr->nOldHit == infoPtr->nHotItem &&
(infoPtr->buttons[infoPtr->nOldHit].fsState & TBSTATE_ENABLED))
{
oldBtnPtr = &infoPtr->buttons[infoPtr->nOldHit];