Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalArgumentException: Cannot construct a Paragraph with an empty list of segments #705

Closed
iamgio opened this issue Mar 17, 2018 · 2 comments

Comments

@iamgio
Copy link
Contributor

iamgio commented Mar 17, 2018

Just have seen #592 but still having this problem.
Using 0.8.2.

Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: Cannot construct a Paragraph with an empty list of segments at org.fxmisc.richtext.model.Paragraph.<init>(Paragraph.java:43) at org.fxmisc.richtext.model.Paragraph.restyle(Paragraph.java:216) at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.lambda$setStyleSpans$7(GenericEditableStyledDocumentBase.java:164) at org.fxmisc.richtext.model.ReadOnlyStyledDocument.lambda$null$7(ReadOnlyStyledDocument.java:272) at org.reactfx.util.Tuple2.map(Tuple2.java:31) at org.fxmisc.richtext.model.ReadOnlyStyledDocument.lambda$replace$8(ReadOnlyStyledDocument.java:271) at org.reactfx.util.Tuple2.map(Tuple2.java:31) at org.fxmisc.richtext.model.ReadOnlyStyledDocument.replace(ReadOnlyStyledDocument.java:270) at org.fxmisc.richtext.model.ReadOnlyStyledDocument.replace(ReadOnlyStyledDocument.java:260) at org.fxmisc.richtext.model.GenericEditableStyledDocumentBase.setStyleSpans(GenericEditableStyledDocumentBase.java:158) at org.fxmisc.richtext.model.SimpleEditableStyledDocument.setStyleSpans(SimpleEditableStyledDocument.java:7) at org.fxmisc.richtext.GenericStyledArea.setStyleSpans(GenericStyledArea.java:1281)

It happens with large texts only, but no idea about the exact source.

EDIT:
Just found out it happens only if group #[^\n]*, which matches everything after a '#', is present and followed by an empty line.

@Jugen
Copy link
Collaborator

Jugen commented Mar 18, 2018

I've tried to reproduce the error according to your edit but without success ?
Could you please provide a test case that fails, so that I can have a look.

Also are you sure you are using 0.8.2 because the line numbers in the stacktrace don't match the source code for that tag (or the master branch) ?

@iamgio
Copy link
Contributor Author

iamgio commented Mar 18, 2018

Also are you sure you are using 0.8.2 because the line numbers in the stacktrace don't match the source code for that tag (or the master branch) ?

I was using 0.8.2 (846kb), tried downloading again and got a 792kb jar. Don't know how that happened but now it works.

@iamgio iamgio closed this as completed Mar 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants