check for null background in TextInput setUnderlineColor

Summary:
checking for background == null to fix this error:

```java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable$ConstantState android.graphics.drawable.Drawable.getConstantState()' on a null object reference
	at com.facebook.react.views.textinput.ReactTextInputManager.setUnderlineColor(:4)
```

Changelog:
[Internal][Fixed] - check for null background in Android TextInput setUnderlineColor

Reviewed By: beatthat

Differential Revision: D40451369

fbshipit-source-id: 8618d5ff73f517f714c26a0b17af078493822244
This commit is contained in:
Sharon Zheng
2022-10-18 14:38:11 -07:00
committed by Facebook GitHub Bot
parent d2fde62f8f
commit b51a350c1e
@@ -633,6 +633,11 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
// See https://code.google.com/p/android/issues/detail?id=191754 for more info
Drawable background = view.getBackground();
Drawable drawableToMutate = background;
if (background == null) {
return;
}
if (background.getConstantState() != null) {
try {
drawableToMutate = background.mutate();