file can not is null.

This commit is contained in:
吴尚昆 2022-03-03 17:14:29 +08:00 committed by osborn
parent 2bac5352e8
commit 85a03bdd93

View File

@ -269,12 +269,8 @@ public class TextNode extends ViewNode<TextView> {
filePath = getContext().getCacheDir().getPath() + File.separator + "DoricTextFonts"; filePath = getContext().getCacheDir().getPath() + File.separator + "DoricTextFonts";
String fileName = URLEncoder.encode(type + "_" + identifier, "UTF-8"); String fileName = URLEncoder.encode(type + "_" + identifier, "UTF-8");
File file = createFile(fontData, filePath, fileName); File file = createFile(fontData, filePath, fileName);
if (file == null) { Typeface customFont = Typeface.createFromFile(file);
DoricLog.e("Error Font file load resource %s", resource.toString()); view.setTypeface(customFont);
} else {
Typeface customFont = Typeface.createFromFile(file);
view.setTypeface(customFont);
}
} catch (Exception e) { } catch (Exception e) {
DoricLog.e("Error Font asset load resource %s", resource.toString()); DoricLog.e("Error Font asset load resource %s", resource.toString());
} }