diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index 413f06c1f..b9cd3aca4 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -319,7 +319,7 @@ void SkScalerContext::getMetrics(SkGlyph* glyph) { SkIRect ir; devPath.getBounds().roundOut(&ir); - if (!ir.is16Bit()) { + if (ir.isEmpty() || !ir.is16Bit()) { goto SK_ERROR; } glyph->fLeft = ir.fLeft; @@ -356,6 +356,9 @@ SK_ERROR: glyph->fTop = 0; glyph->fWidth = 0; glyph->fHeight = 0; + // put a valid value here, in case it was earlier set to + // MASK_FORMAT_JUST_ADVANCE + glyph->fMaskFormat = fRec.fMaskFormat; } void SkScalerContext::getImage(const SkGlyph& origGlyph) {