Skip to content

Commit 0f3be77

Browse files
mdvaccafacebook-github-bot
authored andcommitted
fix possible NPE in StatusBarModule
Summary: This diff fixes a NPE happening in StatusBarModule when the style passed by parameter is null. Even if JS shoulnd't send a null value, this method should not crash with an NPE. I'm not changing behavior, only avoiding NPE when status is null Reviewed By: RSNara Differential Revision: D13287057 fbshipit-source-id: cc5ac4e97083d63f2bf65c03bac0dc9bce976423
1 parent 3749da1 commit 0f3be77

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public void run() {
166166
}
167167

168168
@ReactMethod
169-
public void setStyle(final String style) {
169+
public void setStyle(@Nullable final String style) {
170170
final Activity activity = getCurrentActivity();
171171
if (activity == null) {
172172
FLog.w(ReactConstants.TAG, "StatusBarModule: Ignored status bar change, current activity is null.");
@@ -181,7 +181,7 @@ public void setStyle(final String style) {
181181
public void run() {
182182
View decorView = activity.getWindow().getDecorView();
183183
decorView.setSystemUiVisibility(
184-
style.equals("dark-content") ? View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : 0);
184+
"dark-content".equals(style) ? View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : 0);
185185
}
186186
}
187187
);

0 commit comments

Comments
 (0)