Skip to content

Details getSummaryText throws NullPointerExceptions if summary was not set. #3171

Closed

Description

@nSharifA

Describe your motivation

I wanted to implement this code, where I compare the old and new values of summary text.

if (!Objects.equals(newSummaryText, detail.getSummaryText())) {
  detail.setSummaryText(newSummaryText);
}

Then I've noticed the getSummaryText throws a nullpointerexception because the summary was not set before. I had to do like this:

    if (detail.getSummary() == null || !Objects.equals(newSummaryText, detail.getSummaryText())) {
      detail.setSummaryText(newSummaryText);
    }

Describe the solution you'd like

I think getSummaryText() should return an empty string (or null) if the summary was not set before.
or/and
Details.setSummaryText should do this comparsion before doing any component creation and logic.

Describe alternatives you've considered

No response

Additional context

No response

Activity

  1. added a commit that references this issue on May 13, 2022
    6fb6437
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions