Skip to content

Commit

Permalink
[firebase_dynamic_links] Don't crash if activity is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetf authored Aug 25, 2019
1 parent 58b956f commit 8fe253b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/firebase_dynamic_links/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public boolean onNewIntent(Intent intent) {
FirebaseDynamicLinks.getInstance()
.getDynamicLink(intent)
.addOnSuccessListener(
registrar.activity(),
new OnSuccessListener<PendingDynamicLinkData>() {
@Override
public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
Expand All @@ -53,7 +52,6 @@ public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
}
})
.addOnFailureListener(
registrar.activity(),
new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Expand Down Expand Up @@ -117,6 +115,12 @@ private Map<String, Object> 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(
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_dynamic_links/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
homepage: https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_dynamic_links
Expand Down

0 comments on commit 8fe253b

Please sign in to comment.