diff options
| author | 2011-05-31 16:12:38 -0700 | |
|---|---|---|
| committer | 2011-05-31 16:35:18 -0700 | |
| commit | 83fa41b06e0180d4e86c16f7cb6ae2439183fda8 (patch) | |
| tree | dcaf00fd0921046b9794dbff6dbeb9a6d615d6da | |
| parent | 6e10b08ba9ac7ba4ee1884f9e5cccfd509d76165 (diff) | |
Fix TextView potential NPE in isLayoutRtl()
- test if mDrawables can be null
- see bug #4517017 (was seen with Monkeys)
Change-Id: I07f04c88a238d1cae6fe89b0ab56fc2c456b8534
| -rw-r--r-- | core/java/android/widget/TextView.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index a73a6cff4a9c..34f748a52b80 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -4144,10 +4144,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener @Override public boolean isLayoutRtl(Drawable who) { if (who == null) return false; - final TextView.Drawables drawables = mDrawables; - if (who == drawables.mDrawableLeft || who == drawables.mDrawableRight || - who == drawables.mDrawableTop || who == drawables.mDrawableBottom) { - return isLayoutRtl(); + if (mDrawables != null) { + final Drawables drawables = mDrawables; + if (who == drawables.mDrawableLeft || who == drawables.mDrawableRight || + who == drawables.mDrawableTop || who == drawables.mDrawableBottom) { + return isLayoutRtl(); + } } return super.isLayoutRtl(who); } |