Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: ui/gfx/font_fallback_mac.mm

Issue 2959913002: PlatformFontMac: Use a default NSFont when an invalid font is passed. (Closed)
Patch Set: Use a default font Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/platform_font_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/font_fallback_mac.mm
diff --git a/ui/gfx/font_fallback_mac.mm b/ui/gfx/font_fallback_mac.mm
index 6cfc7e36b8b713de6d9cfacfd347fcc0279bd98e..6a4d66f1d4083966dc287370e117db35e98bb5c8 100644
--- a/ui/gfx/font_fallback_mac.mm
+++ b/ui/gfx/font_fallback_mac.mm
@@ -40,6 +40,7 @@ bool FontsEqual(CTFontRef lhs, CTFontRef rhs) {
} // namespace
std::vector<Font> GetFallbackFonts(const Font& font) {
+ DCHECK(font.GetNativeFont());
// On Mac "There is a system default cascade list (which is polymorphic, based
// on the user's language setting and current font)" - CoreText Programming
// Guide.
@@ -51,6 +52,8 @@ std::vector<Font> GetFallbackFonts(const Font& font) {
static_cast<CTFontRef>(font.GetNativeFont()), languages_cf));
std::vector<Font> fallback_fonts;
+ if (!cascade_list)
+ return fallback_fonts; // This should only happen for an invalid |font|.
const CFIndex fallback_count = CFArrayGetCount(cascade_list);
tapted 2017/06/28 03:46:10 Currently it's this line that crashes -- null can'
for (CFIndex i = 0; i < fallback_count; ++i) {
« no previous file with comments | « no previous file | ui/gfx/platform_font_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698