title: NullPointerException: int android.widget.Editor$SelectionModifierCursorController.getMinTouchOffset()
body: <p>It's a very strange Xiaomi device's OS exception. Even if I do have logs available from Fabric, the stack trace doesn't refer any of my code. </p>
  
  <p>A crash details are below as reported in crashalytics(Fabric),</p>
  
  <ul>
  <li><p>21K crashes</p></li>
  <li><p>All crashes on Xiaomi devices</p></li>
  <li><p>Crashes on Android OS version 6, 7 and 8</p></li>
  </ul>
  
  <p><strong>Crash Log:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code># OS Version: 8.1.0
  # Device: Redmi Note 5 pro
  # RAM Free: 30.1%
  # Disk Free: 74.2%
  
  #0. Crashed: main
         at android.widget.Editor.touchPositionIsInSelection(Editor.java:1084)
         at android.widget.Editor.performLongClick(Editor.java:1205)
         at android.widget.TextView.performLongClick(TextView.java:10908)
         at android.view.View.performLongClick(View.java:6360)
         at android.view.View$CheckForLongPress.run(View.java:24768)
         at android.os.Handler.handleCallback(Handler.java:790)
         at android.os.Handler.dispatchMessage(Handler.java:99)
         at android.os.Looper.loop(Looper.java:171)
         at android.app.ActivityThread.main(ActivityThread.java:6606)
         at java.lang.reflect.Method.invoke(Method.java)
         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:518)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
  
  --
  
  Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.widget.Editor$SelectionModifierCursorController.getMinTouchOffset()' on a null object reference
         at android.widget.Editor.touchPositionIsInSelection(Editor.java:1084)
         at android.widget.Editor.performLongClick(Editor.java:1205)
         at android.widget.TextView.performLongClick(TextView.java:10908)
         at android.view.View.performLongClick(View.java:6360)
         at android.view.View$CheckForLongPress.run(View.java:24768)
         at android.os.Handler.handleCallback(Handler.java:790)
         at android.os.Handler.dispatchMessage(Handler.java:99)
         at android.os.Looper.loop(Looper.java:171)
         at android.app.ActivityThread.main(ActivityThread.java:6606)
         at java.lang.reflect.Method.invoke(Method.java)
         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:518)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
  
  #0. Crashed: main
         at android.widget.Editor.touchPositionIsInSelection(Editor.java:1084)
         at android.widget.Editor.performLongClick(Editor.java:1205)
         at android.widget.TextView.performLongClick(TextView.java:10908)
         at android.view.View.performLongClick(View.java:6360)
         at android.view.View$CheckForLongPress.run(View.java:24768)
         at android.os.Handler.handleCallback(Handler.java:790)
         at android.os.Handler.dispatchMessage(Handler.java:99)
         at android.os.Looper.loop(Looper.java:171)
         at android.app.ActivityThread.main(ActivityThread.java:6606)
         at java.lang.reflect.Method.invoke(Method.java)
         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:518)
         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Similar Reference:</strong></p>
  
  <p><a href="https://issuetracker.google.com/issues/37127697" rel="noreferrer">https://issuetracker.google.com/issues/37127697</a></p>
  
  <p><a href="https://stackoverflow.com/questions/42926522/java-lang-nullpointerexception-with-nougat">java.lang.NullPointerException with Nougat</a></p>
  
  <p>Also asked on Xiaomi official forum <a href="http://en.miui.com/forum.php?mod=viewthread&amp;tid=4595164" rel="noreferrer">http://en.miui.com/forum.php?mod=viewthread&amp;tid=4595164</a></p>
  
  <p>Please do provide any working solution as soon as possible. As users must not be happy with these crashes.</p>
  
  <p>Thanks in advance.</p>