Merge "Bug 5166707: NPE fixed in getFocusedRect"
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 2b94417..c92b5f9 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -4788,8 +4788,7 @@
selEnd = getSelectionEnd();
if (selStart >= 0) {
- if (mHighlightPath == null)
- mHighlightPath = new Path();
+ if (mHighlightPath == null) mHighlightPath = new Path();
if (selStart == selEnd) {
if (isCursorVisible() &&
@@ -4995,6 +4994,7 @@
} else {
// Selection extends across multiple lines -- the focused
// rect covers the entire width.
+ if (mHighlightPath == null) mHighlightPath = new Path();
if (mHighlightPathBogus) {
mHighlightPath.reset();
mLayout.getSelectionPath(selStart, selEnd, mHighlightPath);