Fix called C++ object pointer is null

Signed-off-by: Jérôme Duval <[email protected]>
This commit is contained in:
Murai Takashi
2013-11-10 23:44:12 +01:00
committed by Jérôme Duval
parent be6d2f97cd
commit c347a4d4d4
@@ -1094,14 +1094,18 @@ RemoteDrawingEngine::_ExtractBitmapRegions(ServerBitmap& bitmap, uint32 options,
bitmaps[i] = new(std::nothrow) UtilityBitmap(
BRect(0, 0, targetWidth - 1, targetHeight - 1),
bitmap.ColorSpace(), 0);
if (bitmaps[i] == NULL)
if (bitmaps[i] == NULL) {
result = B_NO_MEMORY;
result = bitmaps[i]->ImportBits(bitmap.Bits(), bitmap.BitsLength(),
bitmap.BytesPerRow(), bitmap.ColorSpace(), sourceRect.LeftTop(),
BPoint(0, 0), targetWidth, targetHeight);
if (result != B_OK)
delete bitmaps[i];
} else {
result = bitmaps[i]->ImportBits(bitmap.Bits(),
bitmap.BitsLength(), bitmap.BytesPerRow(),
bitmap.ColorSpace(), sourceRect.LeftTop(),
BPoint(0, 0), targetWidth, targetHeight);
if (result != B_OK) {
delete bitmaps[i];
bitmaps[i] = NULL;
}
}
}
if (result != B_OK) {