Fix NPE at boot.

This commit is contained in:
Romain Guy
2009-05-20 15:09:21 -07:00
parent fe0daa7da8
commit a6cd4e03e6

View File

@@ -3711,6 +3711,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
// for each compound drawable in onDraw(). Make sure to update each section // for each compound drawable in onDraw(). Make sure to update each section
// accordingly. // accordingly.
final TextView.Drawables drawables = mDrawables; final TextView.Drawables drawables = mDrawables;
if (drawables != null) {
if (drawable == drawables.mDrawableLeft) { if (drawable == drawables.mDrawableLeft) {
final int compoundPaddingTop = getCompoundPaddingTop(); final int compoundPaddingTop = getCompoundPaddingTop();
final int compoundPaddingBottom = getCompoundPaddingBottom(); final int compoundPaddingBottom = getCompoundPaddingBottom();
@@ -3740,6 +3741,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthBottom) / 2; scrollX += compoundPaddingLeft + (hspace - drawables.mDrawableWidthBottom) / 2;
scrollY += (mBottom - mTop - mPaddingBottom - drawables.mDrawableSizeBottom); scrollY += (mBottom - mTop - mPaddingBottom - drawables.mDrawableSizeBottom);
} }
}
invalidate(dirty.left + scrollX, dirty.top + scrollY, invalidate(dirty.left + scrollX, dirty.top + scrollY,
dirty.right + scrollX, dirty.bottom + scrollY); dirty.right + scrollX, dirty.bottom + scrollY);