mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-03-04 15:22:01 -05:00
Catch case where barcode rendering runs into an OOM
There are still cases where the barcode could not be rendered because the process runs out of its memory limit. To avoid a crash, catch the failure and log it. The barcode will not be displayed, but at least the app will not crash.
This commit is contained in:
@@ -149,6 +149,12 @@ class BarcodeImageWriterTask extends AsyncTask<Void, Void, Bitmap>
|
||||
{
|
||||
Log.e(TAG, "Failed to generate barcode of type " + format + ": " + cardId, e);
|
||||
}
|
||||
catch(OutOfMemoryError e)
|
||||
{
|
||||
Log.w(TAG, "Insufficient memory to render barcode, "
|
||||
+ imageWidth + "x" + imageHeight + ", " + format.name()
|
||||
+ ", length=" + cardId.length(), e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user