diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d77ff550c..21341cd193 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes +- Check if the Native SDKs are enabled when using `autoInitializeNativeSdk=false` ([#1489](https://github.com/getsentry/sentry-dart/pull/1489)) - Align http method to span convention ([#1477](https://github.com/getsentry/sentry-dart/pull/1477)) - Wrapped methods return a `Future` instead of executing right away ([#1476](https://github.com/getsentry/sentry-dart/pull/1476)) - Relates to ([#1462](https://github.com/getsentry/sentry-dart/pull/1462)) diff --git a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt index 492638dffc..7ff0f79cac 100644 --- a/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt +++ b/flutter/android/src/main/kotlin/io/sentry/flutter/SentryFlutterPlugin.kt @@ -354,20 +354,25 @@ class SentryFlutterPlugin : FlutterPlugin, MethodCallHandler, ActivityAware { } private fun captureEnvelope(call: MethodCall, result: Result) { + if (!Sentry.isEnabled()) { + result.error("1", "The Sentry Android SDK is disabled", null) + return + } + val args = call.arguments() as List? ?: listOf() if (args.isNotEmpty()) { val event = args.first() as ByteArray? if (event != null && event.isNotEmpty()) { if (!writeEnvelope(event)) { - result.error("3", "SentryOptions or outboxPath are null or empty", null) + result.error("2", "SentryOptions or outboxPath are null or empty", null) } result.success("") return } } - result.error("2", "Envelope is null or empty", null) + result.error("3", "Envelope is null or empty", null) } private fun loadImageList(result: Result) {