Notes: crash when writing title of # heading

Using the Notes widget for Android.

When typing the title of a “#”/H1 heading at the bottom of the note: crash.

If changes to “##”/H2 heading - no crash.


# Granngården
[ ] Ängsfrön 20×30m
[ ] baljor
[ ] tank dagvatten
# Swedol
Olja växellåda traktor SAE 90
# Jula

# Traktorn
Trattar bensik o olja
# Teknik

App Version: 3.4.18
App Version Code: 3004018
App Flavor: play

Files App Version Code: 30190190


OS Version: 4.19.111-23350288(G525FXXS5AVB3)
OS API Level: 30
Device: xcover5
Manufacturer: samsung
Model (and Product): SM-G525F (xcover5eea)


java.lang.RuntimeException: java.lang.IndexOutOfBoundsException: setSpan (203 ... 205) ends beyond length 203
	at io.noties.markwon.editor.MarkwonEditorTextWatcher$WithPreRender$2$
	at android.os.Handler.handleCallback(
	at android.os.Handler.dispatchMessage(
	at android.os.Looper.loop(
	at java.lang.reflect.Method.invoke(Native Method)
Caused by: java.lang.IndexOutOfBoundsException: setSpan (203 ... 205) ends beyond length 203
	at android.text.SpannableStringBuilder.checkRange(
	at android.text.SpannableStringBuilder.setSpan(
	at android.text.SpannableStringBuilder.setSpan(
	at io.noties.markwon.editor.MarkwonEditorImpl$RecordingSpannableStringBuilder.setSpan(
	at io.noties.markwon.editor.MarkwonEditor$SpansHandlerImpl.handle(
	at io.noties.markwon.editor.MarkwonEditorImpl.process(
	at io.noties.markwon.editor.MarkwonEditorImpl.preRender(
	at io.noties.markwon.editor.MarkwonEditorTextWatcher$WithPreRender$
	at java.util.concurrent.Executors$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$

It would probably be better to open an issue directly on GitHub if none exists yet… GitHub - nextcloud/android: 📱 Nextcloud Android app

I already saw this post, let me figure out, what possibly might be wrong here…

I have troubles reproducing the issue.

  • Are you able to reproduce the issue constantly or does it sometimes happen, sometimes not?
  • Can you provide a more minimal sample where the issue occurs?
  • Does the speed of you key strokes influence the happening of the bug? (e. g. happens only when typing fast or slow)

I am having trouble reproducing it now, unfortunately.

When I first encountered the crash, it happened several times in a row when typing at the exact same position. I don’t think it has anything to do with the speed of typing - I think I typed at different speeds.

Yesterday I succeeded reproducing it once with a different text, but the note disappeard after the crash.

Now I succeeded reproducing it once after copy-past the text and fixing the layout with headers. But the text disappeard (was not saved). When trying again I cannot reproduce it - I guess I did something slightly different when trying to layout the text again after copy-paste into a new note.

I will see if I manage to reproduce it.

Thanks for taking your time.

I’ll check whether i am able to finde the cause of the issue in the stacktrace error message you pisted above :slight_smile: Thanks for the update.

Since I have unfortunately not yet been able to reproduce the problem, we’ll keep track of this issue in the corresponding GitHub repository, so it won’t get lost (marking this topic as :white_check_mark: solved here, because from the point of the community help forum other contributors won’t be able to do anything more here).

Please feel free to simply post further information if you found some kind of rule that leads to the error (here or at the linked issue).

In case we find a solution, I will post a comment here too, of course, so you will get notified.