1
0
Fork 1

Last ditch for drawables with no width or height...

(cherry picked from commit c92507be9d8c89ea500bf1ecebae3ec853dae616)
This commit is contained in:
Stephen Paul Weber 2023-10-30 11:06:52 -05:00 committed by 12aw
parent 6fb1f83740
commit 92c7a35c9b

View file

@ -1161,6 +1161,15 @@ public class FileBackend {
int height = drawable.getIntrinsicHeight();
if (height < 1) height = bounds == null || bounds.bottom < 1 ? 256 : bounds.bottom;
if (width < 1) {
Log.w(Config.LOGTAG, "Drawable with no width: " + drawable);
width = 48;
}
if (height < 1) {
Log.w(Config.LOGTAG, "Drawable with no height: " + drawable);
height = 48;
}
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());