1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-22 07:42:52 +00:00

Prevent crash

This commit is contained in:
M66B 2021-01-25 16:03:58 +01:00
parent 497c6bc221
commit 5b3bafbd0c

View file

@ -158,7 +158,20 @@ class ImageHelper {
Paint paint = new Paint();
paint.setColor(lum < t ? Color.WHITE : Color.BLACK);
paint.setTextSize(size / 2f);
paint.setTypeface(Typeface.DEFAULT_BOLD);
try {
paint.setTypeface(Typeface.DEFAULT_BOLD);
} catch (Throwable ex) {
Log.e(ex);
/*
java.lang.NullPointerException: Attempt to invoke interface method 'android.graphics.Typeface miui.util.font.IFontManager.getBaseFont(int)' on a null object reference
at miui.util.TypefaceUtils.updateDefaultFont(TypefaceUtils.java:190)
at miui.util.TypefaceUtils.loadFontManager(TypefaceUtils.java:168)
at miui.util.TypefaceUtils.loadFontSettings(TypefaceUtils.java:64)
at miui.util.TypefaceUtils.useVarFont(TypefaceUtils.java:107)
at android.graphics.Paint.useMiuiVarFont(Paint.java:1460)
at android.graphics.Paint.setTypeface(Paint.java:1443)
*/
}
canvas.drawText(letter,
size / 2f - paint.measureText(letter) / 2,