Skip to content

Commit

Permalink
Handle getCurrentActivity returning null
Browse files Browse the repository at this point in the history
  • Loading branch information
janicduplessis committed Jun 14, 2020
1 parent 01fbf6d commit be578cd
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -199,11 +199,16 @@ else if( tg.equals("end") )

@ReactMethod
public void show(ReadableMap options, final Callback callback) {
if (getCurrentActivity() == null) {
callback.invoke("error", "React Native Activity is null", options.toString());
return;
}
mBuilder = new MaterialDialog.Builder(getCurrentActivity());
try {
applyOptions(mBuilder, options);
} catch (Exception e) {
callback.invoke("error", e.getMessage(), options.toString());
return;
}

if (options.hasKey("onPositive")) {
Expand Down

0 comments on commit be578cd

Please sign in to comment.