* fix CID-258: BView::SetViewOverlay() shouldn't crash if given a NULL bitmap.
Coverity was complaining because we did a half-ass check against NULL only to pass that NULL pointer on to a function that deref'd it. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38248 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3674,7 +3674,7 @@ status_t
|
|||||||
BView::SetViewOverlay(const BBitmap* overlay, BRect srcRect, BRect dstRect,
|
BView::SetViewOverlay(const BBitmap* overlay, BRect srcRect, BRect dstRect,
|
||||||
rgb_color* colorKey, uint32 followFlags, uint32 options)
|
rgb_color* colorKey, uint32 followFlags, uint32 options)
|
||||||
{
|
{
|
||||||
if ((overlay->fFlags & B_BITMAP_WILL_OVERLAY) == 0)
|
if (overlay == NULL || (overlay->fFlags & B_BITMAP_WILL_OVERLAY) == 0)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
status_t status = _SetViewBitmap(overlay, srcRect, dstRect, followFlags,
|
status_t status = _SetViewBitmap(overlay, srcRect, dstRect, followFlags,
|
||||||
@@ -3692,11 +3692,11 @@ status_t
|
|||||||
BView::SetViewOverlay(const BBitmap* overlay, rgb_color* colorKey,
|
BView::SetViewOverlay(const BBitmap* overlay, rgb_color* colorKey,
|
||||||
uint32 followFlags, uint32 options)
|
uint32 followFlags, uint32 options)
|
||||||
{
|
{
|
||||||
BRect rect;
|
if (overlay == NULL)
|
||||||
if (overlay != NULL) {
|
return B_BAD_VALUE;
|
||||||
rect = overlay->Bounds();
|
|
||||||
rect.OffsetTo(B_ORIGIN);
|
BRect rect = overlay->Bounds();
|
||||||
}
|
rect.OffsetTo(B_ORIGIN);
|
||||||
|
|
||||||
return SetViewOverlay(overlay, rect, rect, colorKey, followFlags, options);
|
return SetViewOverlay(overlay, rect, rect, colorKey, followFlags, options);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user