Protect against div-by-zero when mRowHeight is zero. b=431738 r+sr=roc

This commit is contained in:
Mats Palmgren 2008-06-20 06:07:37 +02:00
parent 86d7a7027f
commit 1d73573468

View File

@ -397,7 +397,7 @@ nsListBoxBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState)
NS_IMETHODIMP
nsListBoxBodyFrame::PositionChanged(nsISupports* aScrollbar, PRInt32 aOldIndex, PRInt32& aNewIndex)
{
if (mScrolling)
if (mScrolling || mRowHeight == 0)
return NS_OK;
nscoord oldTwipIndex, newTwipIndex;
@ -449,6 +449,9 @@ nsListBoxBodyFrame::PositionChanged(nsISupports* aScrollbar, PRInt32 aOldIndex,
NS_IMETHODIMP
nsListBoxBodyFrame::VisibilityChanged(nsISupports* aScrollbar, PRBool aVisible)
{
if (mRowHeight == 0)
return NS_OK;
PRInt32 lastPageTopRow = GetRowCount() - (GetAvailableHeight() / mRowHeight);
if (lastPageTopRow < 0)
lastPageTopRow = 0;