diff --git a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUILabel.java b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUILabel.java index 3198fdbea7a..6f25014c0c3 100644 --- a/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUILabel.java +++ b/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUILabel.java @@ -803,12 +803,20 @@ private void updateLabelText() public int getLineCount() { MaterialTextView textView = (MaterialTextView) getNativeView(); - return textView.getLineCount(); + if (textView != null && textView.getLayout() != null) { + return textView.getLineCount(); + } else { + return 0; + } } public String getVisibleText() { MaterialTextView textView = (MaterialTextView) getNativeView(); - return textView.getLayout().getText().toString(); + if (textView != null && textView.getLayout() != null) { + return textView.getLayout().getText().toString(); + } else { + return ""; + } } }