Merge "Fix native crash when typeface is missing"
diff --git a/core/jni/android/graphics/TypefaceImpl.cpp b/core/jni/android/graphics/TypefaceImpl.cpp
index 7767b8d..9ce6de1 100644
--- a/core/jni/android/graphics/TypefaceImpl.cpp
+++ b/core/jni/android/graphics/TypefaceImpl.cpp
@@ -146,10 +146,14 @@
         const FontStyle defaultStyle;
         FontFamily* firstFamily = reinterpret_cast<FontFamily*>(families[0]);
         MinikinFont* mf = firstFamily->getClosestMatch(defaultStyle).font;
-        SkTypeface* skTypeface = reinterpret_cast<MinikinFontSkia*>(mf)->GetSkTypeface();
-        // TODO: probably better to query more precise style from family, will be important
-        // when we open up API to access 100..900 weights
-        result->fStyle = styleFromSkiaStyle(skTypeface->style());
+        if (mf != NULL) {
+            SkTypeface* skTypeface = reinterpret_cast<MinikinFontSkia*>(mf)->GetSkTypeface();
+            // TODO: probably better to query more precise style from family, will be important
+            // when we open up API to access 100..900 weights
+            result->fStyle = styleFromSkiaStyle(skTypeface->style());
+        } else {
+            result->fStyle = defaultStyle;
+        }
     }
     return result;
 }