CID 1500 : Potential NULL poiner dereference.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38140 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-08-16 13:37:10 +00:00
parent 3eedbbbf0e
commit a20769b39c

View File

@ -815,12 +815,14 @@ BChannelSlider::_DrawThumbs()
} }
} }
BPoint drawHere;
BRect bounds(fBacking->Bounds());
drawHere.x = (Bounds().Width() - bounds.Width()) / 2.0;
drawHere.y = (Bounds().Height() - bounds.Height()) - kPadding - fLineFeed;
if (fBacking && fBackingView) { if (fBacking && fBackingView) {
BPoint drawHere;
BRect bounds(fBacking->Bounds());
drawHere.x = (Bounds().Width() - bounds.Width()) / 2.0;
drawHere.y = (Bounds().Height() - bounds.Height()) - kPadding
- fLineFeed;
if (fBacking->Lock()) { if (fBacking->Lock()) {
// Clear the view's background // Clear the view's background
fBackingView->FillRect(fBackingView->Bounds(), B_SOLID_LOW); fBackingView->FillRect(fBackingView->Bounds(), B_SOLID_LOW);
@ -846,8 +848,8 @@ BChannelSlider::_DrawThumbs()
float thumbDelta(ThumbDeltaFor(fCurrentChannel)); float thumbDelta(ThumbDeltaFor(fCurrentChannel));
if (fIsVertical) { if (fIsVertical) {
valueRect.OffsetTo((thumbFrame.Width() - width) / 2.0 + valueRect.OffsetTo((thumbFrame.Width() - width) / 2.0
fCurrentChannel * thumbFrame.Width(), + fCurrentChannel * thumbFrame.Width(),
thumbDelta + thumbFrame.Height() + 2.0); thumbDelta + thumbFrame.Height() + 2.0);
if (valueRect.bottom > fBackingView->Frame().bottom) if (valueRect.bottom > fBackingView->Frame().bottom)
valueRect.OffsetBy(0.0, -(thumbFrame.Height() + 12.0)); valueRect.OffsetBy(0.0, -(thumbFrame.Height() + 12.0));
@ -874,13 +876,12 @@ BChannelSlider::_DrawThumbs()
fBackingView->Sync(); fBackingView->Sync();
fBacking->Unlock(); fBacking->Unlock();
} }
}
if (fBacking)
DrawBitmapAsync(fBacking, drawHere); DrawBitmapAsync(fBacking, drawHere);
// fClickDelta is used in MouseMoved() // fClickDelta is used in MouseMoved()
fClickDelta = drawHere; fClickDelta = drawHere;
}
} }