Fail gracefully if MakeRenderTarget fails
We recently started passing --preAbandonGpuContext when running DM on valgrind, resulting in this call returning nullptr. We had not been checking for it, so we crash. Already fixed one in crrev.com/1959173002, and now we reach another one. BUG=skia:5282 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1972933002 Review-Url: https://codereview.chromium.org/1972933002
This commit is contained in:
parent
7c73a53894
commit
a1b283345b
@ -38,6 +38,9 @@ static sk_sp<SkImage> make_texture(GrContext* ctx, SkPicture* pic, const SkImage
|
||||
return nullptr;
|
||||
}
|
||||
auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
|
||||
if (!surface) {
|
||||
return nullptr;
|
||||
}
|
||||
surface->getCanvas()->clear(0);
|
||||
surface->getCanvas()->drawPicture(pic);
|
||||
return surface->makeImageSnapshot();
|
||||
|
Loading…
Reference in New Issue
Block a user