public TextLayoutBuilder setText()

in library/src/main/java/com/facebook/fbui/textlayoutbuilder/TextLayoutBuilder.java [237:262]


  public TextLayoutBuilder setText(@Nullable CharSequence text) {
    if (text == mParams.text) {
      return this;
    }

    if (Build.VERSION.SDK_INT >= 21 && text instanceof SpannableStringBuilder) {
      // Workaround for https://issuetracker.google.com/issues/117666255
      // We cannot use getSpans here because it omits null spans, even though they exist
      // So instead we just execute the bug repro and catch the NPE
      try {
        text.hashCode();
      } catch (NullPointerException e) {
        throw new IllegalArgumentException(
            "The given text contains a null span. Due to an Android framework bug, this will cause an exception later down the line.",
            e);
      }
    }

    if (text != null && text.equals(mParams.text)) {
      return this;
    }

    mParams.text = text;
    mSavedLayout = null;
    return this;
  }