Fix a possible NPE in View.
Change-Id: Ieebd176e1f42c78e298aca973e9e5eed2dc3c6d9
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index f63c2f1..2cc243e 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -6042,12 +6042,11 @@
int height = mBottom - mTop;
final AttachInfo attachInfo = mAttachInfo;
- final float scale = attachInfo.mApplicationScale;
+ final float scale = attachInfo != null ? attachInfo.mApplicationScale : 1.0f;
width = (int) ((width * scale) + 0.5f);
height = (int) ((height * scale) + 0.5f);
- Bitmap bitmap = Bitmap.createBitmap(width > 0 ? width : 1,
- height > 0 ? height : 1, quality);
+ Bitmap bitmap = Bitmap.createBitmap(width > 0 ? width : 1, height > 0 ? height : 1, quality);
if (bitmap == null) {
throw new OutOfMemoryError();
}