mirror of
https://github.com/status-im/react-native-navbar-color.git
synced 2025-02-28 17:00:33 +00:00
Don't try to work on activity when it's not yet initialized. (#1)
Solve issue: Fatal Exception: java.lang.NullPointerException Attempt to invoke virtual method 'void android.app.Activity.runOnUiThread(java.lang.Runnable)' on a null object reference
This commit is contained in:
parent
f8fd04d0f4
commit
088dff4bc5
@ -30,6 +30,9 @@ public class RNNavBarColorModule extends ReactContextBaseJavaModule {
|
||||
public void setColor(final String color) {
|
||||
final Activity activity = getCurrentActivity();
|
||||
final int colorInt = Color.parseColor(color);
|
||||
if(activity == null)
|
||||
return;
|
||||
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -45,4 +48,4 @@ public class RNNavBarColorModule extends ReactContextBaseJavaModule {
|
||||
return constants;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user