mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
committed by
Facebook GitHub Bot
parent
d2fde62f8f
commit
b51a350c1e
+5
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user