Prevent crash

pull/162/head
M66B 5 years ago
parent 7c445696dc
commit ad5b4f3f73

@ -523,10 +523,10 @@ public class HtmlHelper {
boolean inline = prefs.getBoolean("inline_images", false);
final int px = Helper.dp2pixels(context, (zoom + 1) * 24);
final Resources.Theme theme = context.getTheme();
final Resources res = context.getResources();
try {
final AnnotatedSource a = new AnnotatedSource(source);
if (TextUtils.isEmpty(a.source)) {
@ -739,6 +739,13 @@ public class HtmlHelper {
});
return lld;
} catch (Throwable ex) {
Log.e(ex);
Drawable d = res.getDrawable(R.drawable.baseline_broken_image_24, theme);
d.setBounds(0, 0, px, px);
return d;
}
}
private static void fitDrawable(Drawable d, AnnotatedSource a, View view) {
@ -787,7 +794,7 @@ public class HtmlHelper {
return d;
}
static private Drawable getCachedImage(Context context, File file) {
private static Drawable getCachedImage(Context context, File file) {
if (file.exists()) {
Log.i("Using cached " + file);
Bitmap bm = BitmapFactory.decodeFile(file.getAbsolutePath());

Loading…
Cancel
Save