title: Android. Strange crash in charAt (setSelection)
body: <p>I have a very strange crash in application. 
  Stacktrace:</p>
  
  <pre><code>java.lang.IndexOutOfBoundsException: charAt: -1 &lt; 0
  at android.text.SpannableStringBuilder.charAt(SpannableStringBuilder.java:112)
  at android.text.Selection.setSelection(Selection.java:84)
  at android.text.Selection.setSelection(Selection.java:127)
  at android.widget.Editor$InsertionHandleView.updateSelection(Editor.java:4971)
  at android.widget.Editor$HandleView.positionAtCursorOffset(Editor.java:4647)
  at android.widget.Editor$HandleView.updatePosition(Editor.java:4675)
  at android.widget.Editor$PositionListener.onPreDraw(Editor.java:2714)
  at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:711)
  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2097)
  at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1179)
  at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4859)
  at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
  at android.view.Choreographer.doCallbacks(Choreographer.java:562)
  at android.view.Choreographer.doFrame(Choreographer.java:532)
  at android.view.Choreographer$FrameHandler.handleMessage(Choreographer.java:664)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:5328)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>I got the stack trace without any links on my application's packages (classes/methods). 
  Has anyone encountered this problem? Thx.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Can you see, the stack trace has not any links on my application's packages/classes, but app anyway crashed.</p>
  
  <p><strong>UPD</strong>
  I use Selection.setSelection. I don't use SpannableStringBuilder.</p>
  
  <pre><code>@Override
  public void afterTextChanged(Editable s) {
      if (!s.toString().isEmpty()) {
          Selection.setSelection(s, s.length());
      }   
  }
  </code></pre>