OSDN Git Service

Fix NPE in color tint getting bitmap
authorMatthew Ng <ngmatthew@google.com>
Thu, 21 Feb 2019 19:38:45 +0000 (11:38 -0800)
committerMatthew Ng <ngmatthew@google.com>
Thu, 21 Feb 2019 19:38:48 +0000 (11:38 -0800)
Bug: 112934365
Test: manual

Change-Id: Ie25b5fa2764cbd61ab2b78b5554b08c760446d26

packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java

index cf3f89e..409d60f 100644 (file)
@@ -135,7 +135,7 @@ public class NavBarTintController {
         final Bitmap hardBitmap = SurfaceControl
                 .screenshot(new Rect(), mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels,
                         mNavigationBarView.getContext().getDisplay().getRotation());
-        if (cropRect.bottom <= hardBitmap.getHeight()
+        if (hardBitmap != null && cropRect.bottom <= hardBitmap.getHeight()
                 && cropRect.left + cropRect.width() <= hardBitmap.getWidth()) {
             final Bitmap cropBitmap = Bitmap.createBitmap(hardBitmap, cropRect.left, cropRect.top,
                     cropRect.width(), cropRect.height());