From 9e508546270bb89263e935c6048d85fb10052070 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Sat, 1 Sep 2018 21:14:53 -0700 Subject: [PATCH] Fix crash in text layout when GetMinikinFontCollectionForStyle returns null. (flutter/engine#6139) --- engine/src/flutter/third_party/txt/src/txt/paragraph.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc index 5a4f7a80c8..97a8a05fb4 100644 --- a/engine/src/flutter/third_party/txt/src/txt/paragraph.cc +++ b/engine/src/flutter/third_party/txt/src/txt/paragraph.cc @@ -871,6 +871,9 @@ Paragraph::GetMinikinFontCollectionForStyle(const TextStyle& style) { sk_sp Paragraph::GetDefaultSkiaTypeface(const TextStyle& style) { std::shared_ptr collection = GetMinikinFontCollectionForStyle(style); + if (!collection) { + return nullptr; + } minikin::FakedFont faked_font = collection->baseFontFaked(GetMinikinFontStyle(style)); return static_cast(faked_font.font)->GetSkTypeface();