diff options
author | John Reck <jreck@google.com> | 2015-05-19 15:50:51 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2015-05-19 16:06:16 -0700 |
commit | 3df4869a77bdeb72d5810bbcf7819ed1b8dd0ec7 (patch) | |
tree | ddb8c28bad72c12c0ac0c88c3756b0233c1ea8bc /graphics | |
parent | 95ba62f8d0e753bc7905b915d0b2b510d09c320c (diff) | |
download | frameworks_base-3df4869a77bdeb72d5810bbcf7819ed1b8dd0ec7.zip frameworks_base-3df4869a77bdeb72d5810bbcf7819ed1b8dd0ec7.tar.gz frameworks_base-3df4869a77bdeb72d5810bbcf7819ed1b8dd0ec7.tar.bz2 |
Fix Bitmap#sameAs NPE
Bug: 21281842
Change-Id: I4a1e33d7e642fa50e8789f1441e8587d1c15119c
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/Bitmap.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index a999b71..8ad7c12 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -1575,11 +1575,12 @@ public final class Bitmap implements Parcelable { */ public boolean sameAs(Bitmap other) { checkRecycled("Can't call sameAs on a recycled bitmap!"); + if (this == other) return true; + if (other == null) return false; if (other.isRecycled()) { throw new IllegalArgumentException("Can't compare to a recycled bitmap!"); } - return this == other || (other != null - && nativeSameAs(mFinalizer.mNativeBitmap, other.mFinalizer.mNativeBitmap)); + return nativeSameAs(mFinalizer.mNativeBitmap, other.mFinalizer.mNativeBitmap); } /** |