Prevent DM crash in the PDF sink when src width/height are zero.

Review URL: https://codereview.chromium.org/1061493002
This commit is contained in:
djsollen 2015-04-03 06:38:31 -07:00 committed by Commit bot
parent a156a8ffbe
commit 2ab9000b3f

View File

@ -361,6 +361,9 @@ static Error draw_skdocument(const Src& src, SkDocument* doc, SkWStream* dst) {
int h = SkTMin(kLetterHeight, height - (y * kLetterHeight));
SkCanvas* canvas =
doc->beginPage(SkIntToScalar(w), SkIntToScalar(h));
if (!canvas) {
return "SkDocument::beginPage(w,h) returned NULL";
}
canvas->clipRect(letter);
canvas->translate(-letter.width() * x, -letter.height() * y);
Error err = src.draw(canvas);