am 400659f1: am 2549ff53: Merge "Fix NullPointerException in RecipientsEditor."
# By Bin Li
# Via Android Git Automerger (1) and others
* commit '400659f14936268515b9ad01ace2b13652817876':
Fix NullPointerException in RecipientsEditor.
diff --git a/src/com/android/mms/ui/RecipientsEditor.java b/src/com/android/mms/ui/RecipientsEditor.java
index 7cbb066..4de2118 100644
--- a/src/com/android/mms/ui/RecipientsEditor.java
+++ b/src/com/android/mms/ui/RecipientsEditor.java
@@ -280,6 +280,13 @@
}
private int pointToPosition(int x, int y) {
+ // Check layout before getExtendedPaddingTop().
+ // mLayout is used in getExtendedPaddingTop().
+ Layout layout = getLayout();
+ if (layout == null) {
+ return -1;
+ }
+
x -= getCompoundPaddingLeft();
y -= getExtendedPaddingTop();
@@ -287,11 +294,6 @@
x += getScrollX();
y += getScrollY();
- Layout layout = getLayout();
- if (layout == null) {
- return -1;
- }
-
int line = layout.getLineForVertical(y);
int off = layout.getOffsetForHorizontal(line, x);