Skip to content

🐛 [firebase_dynamic_links] Attempt to invoke virtual method 'android.content.Intent android.app.Activity.getIntent()' on a null object reference #9544

@ChristianEdwardPadilla

Description

@ChristianEdwardPadilla

Bug report

[firebase_dynamic_links/unknown] Attempt to invoke virtual method 'android.content.Intent android.app.Activity.getIntent()' on a null object reference

Stack trace:

#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:653)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:296) <asynchronous suspension>
#2      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:499) <asynchronous suspension>
#3      MethodChannelFirebaseDynamicLinks.getInitialLink (package:third_party.flutter_plugins.firebase_dynamic_links.interface/src/method_channel/method_channel_firebase_dynamic_links.dart:122) <asynchronous suspension>
#4      DeepLinkHandler.openInitialDeepLink (package:ads.adwords_mobileapp.app.infra.deep_link/deep_link_handler.dart:102)
<asynchronous suspension>

It looks like a native exception is being thrown (and caught) in this try-catch block:

Unfortunately the data we have in the Flutter FirebaseException doesn't specify what line or statement threw in Java, so all we know is that .getIntent() is being called on an Activity that happens to be null.

There is asynchronous logic happening here (the bulk of the logic in FlutterFirebaseDynamicLinksPlugin.getDynamicLink is being performed on a separate thread than the main thread). Is it possible that the Activity could be detached while we wait for a result in lines 239-240, so that by the time we call activity.get() in line 242 it could be null?

Steps to reproduce

Unknown, production crash.

FDL version being used: 4.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: androidIssues / PRs which are specifically for Android.plugin: dynamic_linksresolution: fixedA fix has been merged or is pending merge from a PR.resolution: needs-reproThis issue could not be reproduced or needs an up to date reproduction on latest FlutterFire plugin.type: bugSomething isn't workingtype: crashA compile error or crash

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions