OSDN Git Service

no layout = no visibility
authorVictoria Lease <violets@google.com>
Sun, 13 Oct 2013 22:12:52 +0000 (15:12 -0700)
committerVictoria Lease <violets@google.com>
Sun, 13 Oct 2013 22:12:52 +0000 (15:12 -0700)
This fixes an Editor crash when the associated TextView's Layout
is null.

Bug: 11165608
Change-Id: I061c0db6eef95bf39a7696ad6e6f919bd22bfb11

core/java/android/widget/Editor.java

index 2b90281..9dab7b4 100644 (file)
@@ -800,6 +800,8 @@ public class Editor {
 
     private boolean isOffsetVisible(int offset) {
         Layout layout = mTextView.getLayout();
+        if (layout == null) return false;
+
         final int line = layout.getLineForOffset(offset);
         final int lineBottom = layout.getLineBottom(line);
         final int primaryHorizontal = (int) layout.getPrimaryHorizontal(offset);