Fix crash when getLayout() is null.

This commit is contained in:
Lucio Maciel
2021-08-13 18:39:06 -03:00
committed by GitHub
parent a5790edb2b
commit d4cabce876
2 changed files with 8 additions and 3 deletions

View File

@@ -153,7 +153,7 @@ public class EmojiTextView extends AppCompatTextView {
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
CharSequence text = getText();
if (!measureLastLine || text == null || text.length() == 0) {
if (getLayout() == null || !measureLastLine || text == null || text.length() == 0) {
lastLineWidth = -1;
} else {
Layout layout = getLayout();
@@ -175,7 +175,7 @@ public class EmojiTextView extends AppCompatTextView {
}
public boolean isSingleLine() {
return getLayout().getLineCount() == 1;
return getLayout() != null && getLayout().getLineCount() == 1;
}
public void setOverflowText(@Nullable CharSequence overflowText) {