am 1ce0de89: am 400659f1: am 2549ff53: Merge "Fix NullPointerException in RecipientsEditor."
# By Bin Li
# Via Android Git Automerger (2) and others
* commit '1ce0de891c0677ff1caf39ac41a2b1572d613f62':
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);