summaryrefslogtreecommitdiffstats
path: root/iconloaderlib
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2019-02-12 09:59:15 -0800
committerHyunyoung Song <hyunyoungs@google.com>2019-02-12 09:59:15 -0800
commitf04391896afd01b56864710f869f4a9636d0553a (patch)
tree27bf1e335521ba402a4c63125a288ac3467e08b9 /iconloaderlib
parent28616560842608808c7a321278a931cef5f13ac1 (diff)
downloadandroid_packages_apps_Trebuchet-f04391896afd01b56864710f869f4a9636d0553a.tar.gz
android_packages_apps_Trebuchet-f04391896afd01b56864710f869f4a9636d0553a.tar.bz2
android_packages_apps_Trebuchet-f04391896afd01b56864710f869f4a9636d0553a.zip
Prevent NPE inside iconloader library
Bug: 120439430 Even though there is @NonNull annotation, customers may not respect this annotation. Change-Id: I01679d01f6920c3cc945c4abe757b907f150aa23
Diffstat (limited to 'iconloaderlib')
-rw-r--r--iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
index af1b3530e..76abe8d1b 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
@@ -263,7 +263,9 @@ public class BaseIconFactory implements AutoCloseable {
*/
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());