diff --git a/packages/firebase_dynamic_links/CHANGELOG.md b/packages/firebase_dynamic_links/CHANGELOG.md index ff1571681f82..6de4ce5fac87 100644 --- a/packages/firebase_dynamic_links/CHANGELOG.md +++ b/packages/firebase_dynamic_links/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.0+3 + +* Don't crash if registrar.activity() is not there. + ## 0.5.0+2 * Change the OnLinkError object to be a real exception. diff --git a/packages/firebase_dynamic_links/android/src/main/java/io/flutter/plugins/firebasedynamiclinks/FirebaseDynamicLinksPlugin.java b/packages/firebase_dynamic_links/android/src/main/java/io/flutter/plugins/firebasedynamiclinks/FirebaseDynamicLinksPlugin.java index cd5c5ea2456f..9969fc31f2dd 100644 --- a/packages/firebase_dynamic_links/android/src/main/java/io/flutter/plugins/firebasedynamiclinks/FirebaseDynamicLinksPlugin.java +++ b/packages/firebase_dynamic_links/android/src/main/java/io/flutter/plugins/firebasedynamiclinks/FirebaseDynamicLinksPlugin.java @@ -41,7 +41,6 @@ public boolean onNewIntent(Intent intent) { FirebaseDynamicLinks.getInstance() .getDynamicLink(intent) .addOnSuccessListener( - registrar.activity(), new OnSuccessListener() { @Override public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) { @@ -53,7 +52,6 @@ public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) { } }) .addOnFailureListener( - registrar.activity(), new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { @@ -117,6 +115,12 @@ private Map getMapFromPendingDynamicLinkData( } private void handleGetInitialDynamicLink(final Result result) { + // If there's no activity, then there's no initial dynamic link. + if (registrar.activity() == null) { + result.success(null); + return; + } + FirebaseDynamicLinks.getInstance() .getDynamicLink(registrar.activity().getIntent()) .addOnSuccessListener( diff --git a/packages/firebase_dynamic_links/pubspec.yaml b/packages/firebase_dynamic_links/pubspec.yaml index 5a01a84fcfd5..38ba34f9c0a2 100644 --- a/packages/firebase_dynamic_links/pubspec.yaml +++ b/packages/firebase_dynamic_links/pubspec.yaml @@ -1,7 +1,7 @@ name: firebase_dynamic_links description: Flutter plugin for Google Dynamic Links for Firebase, an app solution for creating and handling links across multiple platforms. -version: 0.5.0+2 +version: 0.5.0+3 author: Flutter Team homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_dynamic_links