From fd419b051a43c68b28131d1fd4535af0d21b5039 Mon Sep 17 00:00:00 2001 From: Gilles Debunne Date: Thu, 25 Aug 2011 11:53:26 -0700 Subject: [PATCH] Bug 5166707: NPE fixed in getFocusedRect Change-Id: I1e59ac739f1258c0047a667443f80b2c09ffa12c --- core/java/android/widget/TextView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 683a9843e705e..615aaae0601a5 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -4788,8 +4788,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener 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 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } 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);