From: Matthew Ng Date: Thu, 21 Feb 2019 19:38:45 +0000 (-0800) Subject: Fix NPE in color tint getting bitmap X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=94bea5a651ee413bce9a1d08074f9ef89eb9e9c0;p=android-x86%2Fframeworks-base.git Fix NPE in color tint getting bitmap Bug: 112934365 Test: manual Change-Id: Ie25b5fa2764cbd61ab2b78b5554b08c760446d26 --- diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java index cf3f89ef8788..409d60fa6c17 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavBarTintController.java @@ -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());