|
27 | 27 | import android.view.View;
|
28 | 28 | import android.view.inputmethod.EditorInfo;
|
29 | 29 | import android.widget.TextView;
|
| 30 | +import com.facebook.common.logging.FLog; |
30 | 31 | import com.facebook.infer.annotation.Assertions;
|
31 | 32 | import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
32 | 33 | import com.facebook.react.bridge.ReactContext;
|
|
64 | 65 | */
|
65 | 66 | @ReactModule(name = ReactTextInputManager.REACT_CLASS)
|
66 | 67 | public class ReactTextInputManager extends BaseViewManager<ReactEditText, LayoutShadowNode> {
|
67 |
| - |
| 68 | + public static final String TAG = ReactTextInputManager.class.getSimpleName(); |
68 | 69 | protected static final String REACT_CLASS = "AndroidTextInput";
|
69 | 70 |
|
70 | 71 | private static final int[] SPACING_TYPES = {
|
@@ -464,9 +465,14 @@ public void setUnderlineColor(ReactEditText view, @Nullable Integer underlineCol
|
464 | 465 | // Drawable.mutate() can sometimes crash due to an AOSP bug:
|
465 | 466 | // See https://code.google.com/p/android/issues/detail?id=191754 for more info
|
466 | 467 | Drawable background = view.getBackground();
|
467 |
| - Drawable drawableToMutate = background.getConstantState() != null ? |
468 |
| - background.mutate() : |
469 |
| - background; |
| 468 | + Drawable drawableToMutate = background; |
| 469 | + if (background.getConstantState() != null) { |
| 470 | + try { |
| 471 | + drawableToMutate = background.mutate(); |
| 472 | + } catch (NullPointerException e) { |
| 473 | + FLog.e(TAG, "NullPointerException when setting underlineColorAndroid for TextInput", e); |
| 474 | + } |
| 475 | + } |
470 | 476 |
|
471 | 477 | if (underlineColor == null) {
|
472 | 478 | drawableToMutate.clearColorFilter();
|
|
0 commit comments