Skip to content

assertion failure when Paragraph constructed with empty segment list #345

@hwaite

Description

@hwaite

org.fxmisc.richtext.model.Paragraph(PS,List<StyledText<S>>) fails when assertions are enabled and second argument is empty. Is assertion truly necessary? If so, perhaps invariant should be verified even when assertions not enabled (e.g. "if (segments.isEmpty()) throw new IllegalArgumentException();").

Stack trace:

org.fxmisc.richtext.model.Paragraph.(Paragraph.java:42)
org.fxmisc.richtext.model.Paragraph.restyle(Paragraph.java:218)
org.fxmisc.richtext.model.SimpleEditableStyledDocument.lambda$setStyleSpans$7(SimpleEditableStyledDocument.java:147)
org.fxmisc.richtext.model.SimpleEditableStyledDocument$$Lambda$1131.137893627.apply(Unknown Source:-1)
org.fxmisc.richtext.model.ReadOnlyStyledDocument.lambda$null$7(ReadOnlyStyledDocument.java:288)
org.fxmisc.richtext.model.ReadOnlyStyledDocument$$Lambda$1093.523297059.apply(Unknown Source:-1)
org.reactfx.util.Tuple2.map(Tuple2.java:31)
org.fxmisc.richtext.model.ReadOnlyStyledDocument.lambda$replace$8(ReadOnlyStyledDocument.java:287)
org.fxmisc.richtext.model.ReadOnlyStyledDocument$$Lambda$1091.1289685895.apply(Unknown Source:-1)
org.reactfx.util.Tuple2.map(Tuple2.java:31)
org.fxmisc.richtext.model.ReadOnlyStyledDocument.replace(ReadOnlyStyledDocument.java:286)
org.fxmisc.richtext.model.ReadOnlyStyledDocument.replace(ReadOnlyStyledDocument.java:276)
org.fxmisc.richtext.model.SimpleEditableStyledDocument.setStyleSpans(SimpleEditableStyledDocument.java:141)
org.fxmisc.richtext.model.StyledTextAreaModel.setStyleSpans(StyledTextAreaModel.java:566)
org.fxmisc.richtext.StyledTextArea.setStyleSpans(StyledTextArea.java:995)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions