commit | f04391896afd01b56864710f869f4a9636d0553a | [log] [tgz] |
---|---|---|
author | Hyunyoung Song <hyunyoungs@google.com> | Tue Feb 12 09:59:15 2019 -0800 |
committer | Hyunyoung Song <hyunyoungs@google.com> | Tue Feb 12 09:59:15 2019 -0800 |
tree | 27bf1e335521ba402a4c63125a288ac3467e08b9 | |
parent | 28616560842608808c7a321278a931cef5f13ac1 [diff] |
Prevent NPE inside iconloader library Bug: 120439430 Even though there is @NonNull annotation, customers may not respect this annotation. Change-Id: I01679d01f6920c3cc945c4abe757b907f150aa23
diff --git a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java index af1b353..76abe8d 100644 --- a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java +++ b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
@@ -263,7 +263,9 @@ */ public Bitmap createIconBitmap(Drawable icon, float scale, int size) { Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); - + if (icon == null) { + return bitmap; + } mCanvas.setBitmap(bitmap); mOldBounds.set(icon.getBounds());