IndexOutOfBoundsException: charAt: 49 >= length 69
<p>Being getting some weird exceptions via bug reports for an Android game app.</p>

<p>The specific code that causes the problem is (mOutroTextLayout is a StaticLayout object):</p>

<pre><code>if(mOutroTextLayout != null) {
    canvas.save();
    canvas.translate((25 * mScale) + 0.5f, (78 * mScale) + 0.5f);
    mOutroTextLayout.draw(canvas); // This is line 903
    canvas.translate(-((25 * mScale) + 0.5f), -((78 * mScale) + 0.5f));
    canvas.restore();
}
</code></pre>

<p>The exception error that it generates:</p>

<pre><code>java.lang.IndexOutOfBoundsException: charAt: 49 &gt;= length 69
    at android.text.SpannableStringBuilder.charAt(SpannableStringBuilder.java:112)
    at android.text.Layout.getLineVisibleEnd(Layout.java:967)
    at android.text.Layout.draw(Layout.java:267)
    at android.text.Layout.draw(Layout.java:153)
    at com.myapps.android.myapp.MapView.onDraw(MapView.java:903)
    at com.myapps.android.myapp.MapThread.run(MapThread.java:83)
</code></pre>

<p>What's really confusing me is the 49 >= length 69 error message. I'm hinting towards a problem with threading/synchronization, where mOutroTextLayout is being created/modified in one thread, and accessed in another thread?? </p>
