Skip to content

Commit

Permalink
Return null instead of DCHECKing in PerturbPixelsInternal
Browse files Browse the repository at this point in the history
handle null appropriately in other callers
  • Loading branch information
pilgrim-brave committed Dec 11, 2020
1 parent aca167d commit 2713a4a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ scoped_refptr<blink::StaticBitmapImage> BraveSessionCache::PerturbPixels(
scoped_refptr<blink::StaticBitmapImage>
BraveSessionCache::PerturbPixelsInternal(
scoped_refptr<blink::StaticBitmapImage> image_bitmap) {
DCHECK(image_bitmap);
if (!image_bitmap)
return nullptr;
if (image_bitmap->IsNull())
return image_bitmap;
// convert to an ImageDataBuffer to normalize the pixel data to RGBA, 4 bytes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
brave::GetContentSettingsClientFor(context)) { \
image_ = brave::BraveSessionCache::From(*context).PerturbPixels(settings, \
image_); \
DCHECK(image_); \
}

#include "../../../../../../../../third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
brave::GetContentSettingsClientFor(context)) { \
image_bitmap = brave::BraveSessionCache::From(*context).PerturbPixels( \
settings, image_bitmap); \
if (!image_bitmap) \
return String("data:,"); \
} \
}

Expand Down

0 comments on commit 2713a4a

Please sign in to comment.