diff options
author | 2019-02-25 23:04:57 -0800 | |
---|---|---|
committer | 2019-02-25 23:04:57 -0800 | |
commit | 171beb55db66e92335736cb18e1dd6ed87990684 (patch) | |
tree | 3f2a2c95402b0494c5806d7fc81663c711154731 /graphics/java | |
parent | be1fd400a877183f1a90cc170bd01d8cd0bc0a96 (diff) | |
parent | 73c478f1bdd237d82152b093055d2fd23fe9aa5d (diff) |
Merge "Check recycled when createBitmap" am: cc9f4923d2 am: 2b8063d780
am: 73c478f1bd
Change-Id: Ic8daf7c007670b096e3b7193fe9ccfed3061ff93
Diffstat (limited to 'graphics/java')
-rw-r--r-- | graphics/java/android/graphics/Bitmap.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index 60ce595b82b8..920fb4cffbca 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -836,7 +836,7 @@ public final class Bitmap implements Parcelable { * @return A bitmap that represents the specified subset of source * @throws IllegalArgumentException if the x, y, width, height values are * outside of the dimensions of the source bitmap, or width is <= 0, - * or height is <= 0 + * or height is <= 0, or if the source bitmap has already been recycled */ public static Bitmap createBitmap(@NonNull Bitmap source, int x, int y, int width, int height, @Nullable Matrix m, boolean filter) { @@ -849,6 +849,9 @@ public final class Bitmap implements Parcelable { if (y + height > source.getHeight()) { throw new IllegalArgumentException("y + height must be <= bitmap.height()"); } + if (source.isRecycled()) { + throw new IllegalArgumentException("cannot use a recycled source in createBitmap"); + } // check if we can just return our argument unchanged if (!source.isMutable() && x == 0 && y == 0 && width == source.getWidth() && |