Fix NPE at boot.
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index b7fbc0e..40a72a4 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -3711,34 +3711,36 @@
             // for each compound drawable in onDraw(). Make sure to update each section
             // accordingly.
             final TextView.Drawables drawables = mDrawables;
-            if (drawable == drawables.mDrawableLeft) {
-                final int compoundPaddingTop = getCompoundPaddingTop();
-                final int compoundPaddingBottom = getCompoundPaddingBottom();
-                final int vspace = mBottom - mTop - compoundPaddingBottom - compoundPaddingTop;
+            if (drawables != null) {
+                if (drawable == drawables.mDrawableLeft) {
+                    final int compoundPaddingTop = getCompoundPaddingTop();
+                    final int compoundPaddingBottom = getCompoundPaddingBottom();
+                    final int vspace = mBottom - mTop - compoundPaddingBottom - compoundPaddingTop;
 
-                scrollX += mPaddingLeft;
-                scrollY += compoundPaddingTop + (vspace - drawables.mDrawableHeightLeft) / 2;
-            } else if (drawable == drawables.mDrawableRight) {
-                final int compoundPaddingTop = getCompoundPaddingTop();
-                final int compoundPaddingBottom = getCompoundPaddingBottom();
-                final int vspace = mBottom - mTop - compoundPaddingBottom - compoundPaddingTop;
+                    scrollX += mPaddingLeft;
+                    scrollY += compoundPaddingTop + (vspace - drawables.mDrawableHeightLeft) / 2;
+                } else if (drawable == drawables.mDrawableRight) {
+                    final int compoundPaddingTop = getCompoundPaddingTop();
+                    final int compoundPaddingBottom = getCompoundPaddingBottom();
+                    final int vspace = mBottom - mTop - compoundPaddingBottom - compoundPaddingTop;
 
-                scrollX += (mRight - mLeft - mPaddingRight - drawables.mDrawableSizeRight);
-                scrollY += compoundPaddingTop + (vspace - drawables.mDrawableHeightRight) / 2;
-            } else if (drawable == drawables.mDrawableTop) {
-                final int compoundPaddingLeft = getCompoundPaddingLeft();
-                final int compoundPaddingRight = getCompoundPaddingRight();
-                final int hspace = mRight - mLeft - compoundPaddingRight - compoundPaddingLeft;
+                    scrollX += (mRight - mLeft - mPaddingRight - drawables.mDrawableSizeRight);
+                    scrollY += compoundPaddingTop + (vspace - drawables.mDrawableHeightRight) / 2;
+                } else if (drawable == drawables.mDrawableTop) {
+                    final int compoundPaddingLeft = getCompoundPaddingLeft();
+                    final int compoundPaddingRight = getCompoundPaddingRight();
+                    final int hspace = mRight - mLeft - compoundPaddingRight - compoundPaddingLeft;
 
-                scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthTop) / 2;
-                scrollY += mPaddingTop;
-            } else if (drawable == drawables.mDrawableBottom) {
-                final int compoundPaddingLeft = getCompoundPaddingLeft();
-                final int compoundPaddingRight = getCompoundPaddingRight();
-                final int hspace = mRight - mLeft - compoundPaddingRight - compoundPaddingLeft;
+                    scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthTop) / 2;
+                    scrollY += mPaddingTop;
+                } else if (drawable == drawables.mDrawableBottom) {
+                    final int compoundPaddingLeft = getCompoundPaddingLeft();
+                    final int compoundPaddingRight = getCompoundPaddingRight();
+                    final int hspace = mRight - mLeft - compoundPaddingRight - compoundPaddingLeft;
 
-                scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthBottom) / 2;
-                scrollY += (mBottom - mTop - mPaddingBottom - drawables.mDrawableSizeBottom);
+                    scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthBottom) / 2;
+                    scrollY += (mBottom - mTop - mPaddingBottom - drawables.mDrawableSizeBottom);
+                }
             }
 
             invalidate(dirty.left + scrollX, dirty.top + scrollY,