Fix TextView potential NPE in isLayoutRtl()
- test if mDrawables can be null
- see bug #4517017 (was seen with Monkeys)
Change-Id: I07f04c88a238d1cae6fe89b0ab56fc2c456b8534
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index a73a6cf..34f748a 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -4144,10 +4144,12 @@
@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);
}