Skip to content

Commit

Permalink
Fix NPE on ReactTextInputManager.setTextDecorationLine
Browse files Browse the repository at this point in the history
Summary:
Fixes facebook#39659

Fix is pretty straightforward, parameter is annotated as Nullable, but is accessed with a `.split` call.
This causes a crash when the `textDecorationLine` property is removed (i.e. is null).

Changelog:
[Android] [Fixed] - Fix NPE on ReactTextInputManager.setTextDecorationLine

Differential Revision: D63689492
  • Loading branch information
cortinico authored and facebook-github-bot committed Oct 1, 2024
1 parent 223e98c commit da1c80f
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,9 @@ public void setTextDecorationLine(ReactEditText view, @Nullable String textDecor
view.setPaintFlags(
view.getPaintFlags() & ~(Paint.STRIKE_THRU_TEXT_FLAG | Paint.UNDERLINE_TEXT_FLAG));

if (textDecorationLineString == null) {
return;
}
for (String token : textDecorationLineString.split(" ")) {
if (token.equals("underline")) {
view.setPaintFlags(view.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
Expand Down

0 comments on commit da1c80f

Please sign in to comment.