godot android intent using GodotUniversalIntentPlugin

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DexterFstone

hi I’m using GodotUniversalIntentPlugin and I try to get content from the user but when the button is pressed game crashes, how to fix it?

extends Node2D

@onready var label = $CanvasLayer/Control/Label

var plugin
var plugin_name = "GodotUniversalIntent"

func _ready():
	if Engine.has_singleton(plugin_name):
		plugin = Engine.get_singleton(plugin_name)
	else:
		label.text = "Could not load plugin: " + plugin_name
	if plugin:
		plugin.connect("on_main_activity_result", self, "_on_main_activity_result")
		plugin.connect("error", self, "_on_error")

func _on_main_activity_result(result):
	label.text = result

func _on_error(error):
	label.text = error

func _on_button_pressed():
	if plugin:
		plugin.intent("android.Intent.ACTION_GET_CONTENT")
		plugin.setType("*/*")
		plugin.startActivityForResult()
	else:
		label.text = plugin_name + " plugin not loaded!"