Commit 493fb33a authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Don't convert an empty gfx::Image to a UIImage.

WKWebView -takeSnapshotWithConfiguration can return a nil
UIImage if there is an error.

Change-Id: Ifb1de97f9afed7436b5fae655ac9a35facdc2868
Reviewed-on: https://chromium-review.googlesource.com/c/1316750Reviewed-by: default avataredchin <edchin@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606047}
parent cdd0e274
......@@ -262,11 +262,14 @@ BOOL ViewHierarchyContainsWKWebView(UIView* view) {
SnapshotGenerator* strongSelf = weakSelf;
if (!strongSelf || !_webState)
return;
UIImage* snapshot = image.ToUIImage();
if (overlays.count > 0) {
snapshot = [strongSelf snapshotWithOverlays:overlays
snapshot:snapshot
frame:snapshotFrame];
UIImage* snapshot = nil;
if (!image.IsEmpty()) {
snapshot = image.ToUIImage();
if (overlays.count > 0) {
snapshot = [strongSelf snapshotWithOverlays:overlays
snapshot:snapshot
frame:snapshotFrame];
}
}
[strongSelf.snapshotCache setImage:snapshot
withSessionID:_snapshotSessionId];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment