File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
ReactAndroid/src/main/java/com/facebook/react/views/text Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -189,13 +189,11 @@ private static Typeface createAssetTypefaceWithFallbacks(
189
189
// Iterate over the list of fontFamilyNames, constructing new FontFamily objects
190
190
// for use in the CustomFallbackBuilder below.
191
191
for (String fontFamilyName : fontFamilyNames ) {
192
- String extension = EXTENSIONS [style ];
193
192
for (String fileExtension : FILE_EXTENSIONS ) {
194
193
String fileName =
195
194
new StringBuilder ()
196
195
.append (FONTS_ASSET_PATH )
197
196
.append (fontFamilyName )
198
- .append (extension )
199
197
.append (fileExtension )
200
198
.toString ();
201
199
try {
@@ -212,6 +210,11 @@ private static Typeface createAssetTypefaceWithFallbacks(
212
210
}
213
211
}
214
212
213
+ // If there's some problem constructing fonts, fall back to the default behavior.
214
+ if (fontFamilies .size () == 0 ) {
215
+ return createAssetTypeface (fontFamilyNames [0 ], style , assetManager );
216
+ }
217
+
215
218
Typeface .CustomFallbackBuilder fallbackBuilder = new Typeface .CustomFallbackBuilder (fontFamilies .get (0 ));
216
219
for (int i = 1 ; i < fontFamilies .size (); i ++) {
217
220
fallbackBuilder .addCustomFallback (fontFamilies .get (i ));
You can’t perform that action at this time.
0 commit comments