From e11232287296eefc82cd895b8392079feedb37cc Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Mon, 29 Jun 2009 14:24:56 -0700 Subject: [PATCH] Fixes #1949502. Prevents an NPE in View.buildDrawingCache(). --- core/java/android/view/View.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index c9a785c6bdcec..b3180caaf265d 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -5922,8 +5922,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility int height = mBottom - mTop; final AttachInfo attachInfo = mAttachInfo; + final boolean scalingRequired = attachInfo != null && attachInfo.mScalingRequired; - if (autoScale && attachInfo != null && attachInfo.mScalingRequired) { + if (autoScale && scalingRequired) { width = (int) ((width * attachInfo.mApplicationScale) + 0.5f); height = (int) ((height * attachInfo.mApplicationScale) + 0.5f); } @@ -6014,7 +6015,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility computeScroll(); final int restoreCount = canvas.save(); - if (autoScale && attachInfo.mScalingRequired) { + if (autoScale && scalingRequired) { final float scale = attachInfo.mApplicationScale; canvas.scale(scale, scale); }