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) {
DoricLog.e("Error Font file load resource %s", resource.toString());
} else {
Typeface customFont = Typeface.createFromFile(file); Typeface customFont = Typeface.createFromFile(file);
view.setTypeface(customFont); 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());
} }