diff --git a/flow/layers/performance_overlay_layer.cc b/flow/layers/performance_overlay_layer.cc index f88a77a433182..59fa6dd5d8c07 100644 --- a/flow/layers/performance_overlay_layer.cc +++ b/flow/layers/performance_overlay_layer.cc @@ -76,10 +76,19 @@ sk_sp PerformanceOverlayLayer::MakeStatisticsText( SkFont font; sk_sp font_mgr = txt::GetDefaultFontManager(); if (font_path == "") { - font = SkFont(font_mgr->matchFamilyStyle(nullptr, {}), 15); + if (sk_sp face = font_mgr->matchFamilyStyle(nullptr, {})) { + font = SkFont(face, 15); + } else { + // In Skia's Android fontmgr, matchFamilyStyle can return null instead + // of falling back to a default typeface. If that's the case, we can use + // legacyMakeTypeface, which *does* use that default typeface. + font = SkFont(font_mgr->legacyMakeTypeface(nullptr, {}), 15); + } } else { font = SkFont(font_mgr->makeFromFile(font_path.c_str()), 15); } + // Make sure there's not an empty typeface returned, or we won't see any text. + FML_DCHECK(font.getTypeface()->countGlyphs() > 0); double max_ms_per_frame = stopwatch.MaxDelta().ToMillisecondsF(); double average_ms_per_frame = stopwatch.AverageDelta().ToMillisecondsF();